This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
objc patch (was Re: Problem to install GCC 4.6.0 with Objec tive-C language)
- From: "Nicola Pero" <nicola dot pero at meta-innovation dot com>
- To: german at xelalug dot org
- Cc: "Ian Lance Taylor" <iant at google dot com>, "GCC" <gcc-help at gcc dot gnu dot org>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Date: Sat, 21 May 2011 14:22:17 +0200 (CEST)
- Subject: objc patch (was Re: Problem to install GCC 4.6.0 with Objec tive-C language)
>I get the error (this time the objc language is detected):
>
>/bin/bash ../../gcc-4.6.0/gcc/../move-if-change tmp-gi.list
>gtyp-input.list
>echo timestamp > s-gtyp-input
>build/gengtype \
> -S ../../gcc-4.6.0/gcc -I gtyp-input.list -w
>gtype.state
>../../gcc-4.6.0/gcc/objc/objc-act.h:280: unidentified type
>`objc_ivar_visibility_kind'
> make[3]: *** [s-gtype] Error 1
Thanks German ... I could reproduce it. You found a bug! :-)
Apologies for the bug, and thanks for sticking with us. ;-)
(you can ignore the following, it's for gcc-patches@gnu.org)
It's easy to reproduce the bug by simply deleting the gcc/cp directory from a GCC checkout,
then trying to compile with the c,objc languages enabled. It fails with the error above,
because gengtype then reads objc/objc-act.h before c-family/c-common-objc.h.
The problem is in how the list of language-specific gtfiles is produced. It is produced
in configure.ac, which:
* will iterate over all the ${srcdir}/*/config-lang.in;
* will source config-lang.in for all of them, regardless of whether they are enabled or not, and add $gtfiles to the list of gtfiles;
* adds the C language last.
As a consequence, GTFILES is different depending on whether ${srcdir}/gcc/cp/ exists or not. If it exists, usually the cp gtfiles
come before the objc ones (due to alphabetical ordering by the shell, I'd guess ?), and the cp gtfiles contain c-family/c-common-objc.h,
which is then processed before objc/objc-act.h. If it doesn't exist, that doesn't happen, and it stops working. :-(
Here is a patch to fix it. It just moves c-family/c-objc.h at the beginning of the objc gtfiles list, to make it independent of cp's
gtfiles list; with this, I can build c,objc with or without the gcc/cp directory. :-)
Ok to commit ?
Thanks
PS: In my view this fix is a candidate for backporting to 4.6.x; without it, the gcc-objc-4.6.x tarballs are unusable.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 173994)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2011-05-21 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * config-lang.in (gtfiles): Updated order of files to fix building
+ when the gcc/cp directory is missing, as in the case of some
+ release tarballs.
+
2011-05-20 Nathan Froyd <froydnj@codesourcery.com>
* objc-act.c (objc_compare_types): Use function_args_iterator
Index: config-lang.in
===================================================================
--- config-lang.in (revision 173994)
+++ config-lang.in (working copy)
@@ -33,4 +33,7 @@
# Most of the object files for cc1obj actually come from C.
lang_requires="c"
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c-parser.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-lang.h \$(srcdir)/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c"
+# Order is important. If you change this list, make sure you test
+# building without C++ as well; that is, remove the gcc/cp directory,
+# and build with --enable-languages=c,objc.
+gtfiles="\$(srcdir)/c-family/c-objc.h \$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c-parser.c \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-lang.h \$(srcdir)/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c"