This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Scott A Sumner writes: > Hi, > > Can I do something like the following? If so, can anyone help me out > with the exact syntax? > > #if (compiling using -fomit-frame-pointer) > // do this > #else > // do that > #endif There is a way to accomplish this but it's a hack. I only mention it here for information's sake. I don't recommend doing this. Instead, have your Makefile specify the appropriate thing. What you want to do is create your own specs file and have it predefine something if -fomit-frame-pointer is specified. N.B. The -B./ argument below is used to tell gcc where to find the specs file. Make sure there is nothing else in the directory that you don't want gcc to use. [e.g. having a symlink called `as' to /bin/sh would not be a good idea :-) [sh won't understand the arguments anyway but you get the point]] On my i386-linux box: --- gcc -dumpspecs >specs Edit specs and apply this: --- specs.~1~ Fri Mar 17 17:49:01 2000 +++ specs Fri Mar 17 17:49:26 2000 @@ -5,7 +5,7 @@ %| *cpp: -%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} +%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} %{fomit-frame-pointer:-DFOMIT_FRAME_POINTER} *cc1: %(cc1_cpu) %{profile:-p} --- foo.c: #ifdef FOMIT_FRAME_POINTER int omitted; #else int nope; #endif --- gcc -B./ -E foo.c # 1 "foo.c" int nope; --- gcc -B./ -E -fomit-frame-pointer foo.c # 1 "foo.c" int omitted; --- ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |