]> gcc.gnu.org Git - gcc.git/commitdiff
re PR objc/30479 (Precompiled headers don't seem to work with GNU ObjC)
authorAndrew Pinski <pinskia@gmail.com>
Sun, 21 Jan 2007 06:51:07 +0000 (22:51 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 21 Jan 2007 06:51:07 +0000 (22:51 -0800)
2007-01-20  Andrew Pinski  <pinskia@gmail.com>

        PR objc/30479
        * objc-act.c (hash_interface): Use IDENTIFIER_HASH_VALUE instead
        of htab_hash_pointer.
        (lookup_interface): Likewise.
        (add_class): Likewise.

2007-01-20  Andrew Pinski  <pinskia@gmail.com>

        PR objc/30479
        * objc.dg/pch: New directory.
        * objc.dg/pch/pch.exp: New file.
        * objc.dg/pch/interface-1.m: New test.
        * objc.dg/pch/interface-1.hs: New include file.
        * lib/objc.exp (objc_target_compile): Add
        "-x objective-c-header" in front of the sources if this is
        a precompiled header being compiled.

From-SVN: r121024

gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/testsuite/ChangeLog
gcc/testsuite/lib/objc.exp
gcc/testsuite/objc.dg/pch/interface-1.hs [new file with mode: 0644]
gcc/testsuite/objc.dg/pch/interface-1.m [new file with mode: 0644]
gcc/testsuite/objc.dg/pch/pch.exp [new file with mode: 0644]

index 0759c8db9e0f9f78289f6dbb7a1091bdc05ca81c..f3aeb9b3bdd83cf2f4b36866d4ba13e211615698 100644 (file)
@@ -1,3 +1,11 @@
+2007-01-20  Andrew Pinski  <pinskia@gmail.com>
+
+       PR objc/30479
+       * objc-act.c (hash_interface): Use IDENTIFIER_HASH_VALUE instead
+       of htab_hash_pointer.
+       (lookup_interface): Likewise.
+       (add_class): Likewise.
+
 2007-01-02  Douglas Gregor  <doug.gregor@gmail.com>
        
        * objc-act.c (objc_build_volatilized_type): Keep track of
index bd79796df7e3620b6a79cc58247c271cd886a0dd..86bfd37b6654d6c47a197c4d1965b08a8d22771f 100644 (file)
@@ -3298,7 +3298,7 @@ static hashval_t
 hash_interface (const void *p)
 {
   const struct interface_tuple *d = p;
-  return htab_hash_pointer (d->id);
+  return IDENTIFIER_HASH_VALUE (d->id);
 }
 
 static int
@@ -3327,7 +3327,7 @@ lookup_interface (tree ident)
       {
        slot = (struct interface_tuple **)
          htab_find_slot_with_hash (interface_htab, ident,
-                                   htab_hash_pointer (ident),
+                                   IDENTIFIER_HASH_VALUE (ident),
                                    NO_INSERT);
        if (slot && *slot)
          i = (*slot)->class_name;
@@ -6997,7 +6997,7 @@ add_class (tree class_name, tree name)
     interface_htab = htab_create_ggc (31, hash_interface, eq_interface, NULL);
   slot = (struct interface_tuple **)
     htab_find_slot_with_hash (interface_htab, name,
-                             htab_hash_pointer (name),
+                             IDENTIFIER_HASH_VALUE (name),
                              INSERT);
   if (!*slot)
     {
index 07d2e5f5fc10aa653282af78ef81e1c2804972b9..320c90203591d88b070143879d2dc75b6f105c79 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-20  Andrew Pinski  <pinskia@gmail.com>
+
+       PR objc/30479
+       * objc.dg/pch: New directory.
+       * objc.dg/pch/pch.exp: New file.
+       * objc.dg/pch/interface-1.m: New test.
+       * objc.dg/pch/interface-1.hs: New include file.
+       * lib/objc.exp (objc_target_compile): Add
+       "-x objective-c-header" in front of the sources if this is
+       a precompiled header being compiled.
+
 2007-01-20  Roger Sayle  <roger@eyesopen.com>
 
        * gfortran.dg/array_memcpy_3.f90: New test case.
index 18cdfeaa880a3ee7046b37e3139eb1276bb5c9c8..0336d3b3dd6d7349335f4797a6b4108e7810ebbd 100644 (file)
@@ -187,6 +187,11 @@ proc objc_target_compile { source dest type options } {
        lappend options "additional_flags=${objc_link_flags}"
        append ld_library_path ":${libobjc_dir}"
     }
+    if { $type == "precompiled_header" } {
+       # If we generating a precompiled header, we have say this is an
+       # objective-C header
+       set source [concat "-x objective-c-header" $source]
+    }
     lappend options "compiler=$OBJC_UNDER_TEST"
 
     set_ld_library_path_env_vars
diff --git a/gcc/testsuite/objc.dg/pch/interface-1.hs b/gcc/testsuite/objc.dg/pch/interface-1.hs
new file mode 100644 (file)
index 0000000..fe5255a
--- /dev/null
@@ -0,0 +1,4 @@
+@interface TestClass
++ (int) test;
+@end
+
diff --git a/gcc/testsuite/objc.dg/pch/interface-1.m b/gcc/testsuite/objc.dg/pch/interface-1.m
new file mode 100644 (file)
index 0000000..9bc7ef3
--- /dev/null
@@ -0,0 +1,14 @@
+#include "interface-1.h"
+
+@implementation TestClass
++ (int) test
+{
+  return 0;
+}
+@end
+
+int main (void)
+{
+  return [TestClass test];
+}
+
diff --git a/gcc/testsuite/objc.dg/pch/pch.exp b/gcc/testsuite/objc.dg/pch/pch.exp
new file mode 100644 (file)
index 0000000..ad5697b
--- /dev/null
@@ -0,0 +1,43 @@
+#   Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  
+
+# GCC testsuite for precompiled header interaction,
+# that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib objc-dg.exp
+load_lib dg-pch.exp
+
+# Initialize `dg'.
+dg-init
+
+set old_dg_do_what_default "${dg-do-what-default}"
+
+# Main loop.
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.m]] {
+    global torture_without_loops
+
+    # We don't try to use the loop-optimizing options, since they are highly
+    # unlikely to make any difference to PCH.  However, we do want to
+    # add -O0 -g, since users who want PCH usually want debugging and quick
+    # compiles.
+    dg-pch $subdir $test [concat [list {-O0 -g}] $torture_without_loops] ".h"
+}
+
+set dg-do-what-default "$old_dg_do_what_default"
+
+# All done.
+dg-finish
This page took 0.144592 seconds and 5 git commands to generate.