This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-E and -fgnu-runtime options - bug or feature?


I recently run in a problem with a configure script. The script uses the "-E" option of gcc (gcc version 4.0.0 20040919 (experimental)) to get hold of the preprocessor output of gcc. However, this option doesn't seem to work together with the "-fgnu-runtime" option. I always get warnings like:

cc1: warning: command line option "-fgnu-runtime" is valid for ObjC/ObjC++ but not for C

but worse is that in result gcc also does the "wrong thing (TM)":

I have stripped down the testcase to the following small program (conftest.c):

#include <objc/objc-api.h>

main()
{

}

If I use gcc on that like:

localhost:~/GNUstep-Darwin/test lars$ /opt/local/bin/gcc -E -x objective-c -fgnu-runtime conftest.c

I get:

cc1: warning: command line option "-fgnu-runtime" is valid for ObjC/ObjC++ but not for C
# 1 "conftest.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "conftest.c"
# 1 "/usr/include/objc/objc-api.h" 1 3 4
# 2 "conftest.c" 2


main()
{

}

which is wrong because /usr/include/objc/objc-api.h got included which is the objc-api.h of the next-runtime (default on Darwin).

If I instead use gcc like:

localhost:~/GNUstep-Darwin/test lars$ /opt/local/bin/gcc -x objective-c -fgnu-runtime -save-temps conftest.c

I get a file "conftest.mi" which starts like:

# 1 "conftest.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "conftest.c"
# 1 "/opt/local/bin/../lib/gcc/i686-apple-darwin7.2.1/4.0.0/include-gnu- runtime/objc/objc-api.h" 1 3 4
# 30 "/opt/local/bin/../lib/gcc/i686-apple-darwin7.2.1/4.0.0/include-gnu- runtime/objc/objc-api.h" 3 4


As you see here gcc has done the "rigth thing (TM)" it included the gnu-runtime objc-api.h

Is the mutually exclusion off "-E" and "-fgnu-runtime" a bug or a feature (I heard different opinions on that when asking this question in #gnustep)

Experts, please elaborate!

by the way: Apples gcc (gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)) doesn't hiccup if it gets "-E" and "-fgnu-runtime" at once but it also does the the wrong thing.

regards, Lars


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]