Patchwork objc patch (was Re: Problem to install GCC 4.6.0 with Objective-C language)

login
register
mail settings
Submitter Nicola Pero
Date May 21, 2011, 12:22 p.m.
Message ID <1305980537.775713961@www2.webmail.us>
Download mbox | patch
Permalink /patch/96695/
State New
Headers show

Comments

Nicola Pero - May 21, 2011, 12:22 p.m.
>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.
Ian Taylor - May 21, 2011, 3:16 p.m.
"Nicola Pero" <nicola.pero@meta-innovation.com> writes:

> +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.

This is OK for trunk and 4.6 branch.

Thanks for figuring it out.

Ian

Patch

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"