This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
CPP wrapper mishandles -A- (was: cpp bug?)
- To: Jim Pick <jim at jimpick dot com>
- Subject: CPP wrapper mishandles -A- (was: cpp bug?)
- From: Daniel Jacobowitz <dan at debian dot org>
- Date: Wed, 21 Jul 1999 20:14:59 -0400
- Cc: debian-toolchain at lists dot debian dot org, gcc-bugs at gcc dot gnu dot org
- References: <87pv1lvfip.fsf@pepper.jimpick.com>
I see the problem.
-A- clears any predefined macros, and any macros before it on the
command line. But the cpp wrapper places the -A- _before_ the macros
gcc wants predefined!
$ cpp -v -A- -dM /dev/null
/usr/lib/gcc-lib/powerpc-debian-linux-gnu/2.95/cpp -lang-c -v -A-
-DPPC -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC
-D__powerpc -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -dM
-D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)
-D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix)
-Asystem(posix) /dev/null
If the cpp from /usr/lib/gcc-lib/powerpc-debian-linux-gnu/2.95/ is
invoked directly, with or without -A-, it has no predefines. If it is
invoked from /usr/bin/cpp with or without -A-, it does have predefines.
Does this patch put -A options in a more appropriate place?
On Wed, Jul 21, 1999 at 02:50:38PM -0700, Jim Pick wrote:
> Hi,
>
> I encountered this when trying to figure out how come my control.in
> wasn't coming out right. I was getting "Architecture: 1", not
> "Architecture: ARM".
>
> Normally, cpp defines some default macros (a.k.a. assertions).
>
> # cpp /dev/null -dM
> #define __linux__ 1
> #define __ARM_ARCH_3__ 1
> #define __arm_elf 1
> #define arm_elf 1
> #define __arm__ 1
> #define linux 1
> #define __arm 1
> #define __arm_elf__ 1
> #define arm 1
> #define __CHAR_UNSIGNED__ 1
> #define __unix 1
> #define __unix__ 1
> #define __APCS_32__ 1
> #define __linux 1
> #define __ELF__ 1
> #define unix 1
>
> The -A- option (as used by the gcc debian/rules) is supposed to turn
> these off. But with the cpp supplied with 2.95 doesn't do this. I
> verified this on i386 and ARM.
>
> Cheers,
>
> - Jim
>
>
> --
> To UNSUBSCRIBE, email to debian-toolchain-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
Dan
/--------------------------------\ /--------------------------------\
| Daniel Jacobowitz |__| SCS Class of 2002 |
| Debian GNU/Linux Developer __ Carnegie Mellon University |
| dan@debian.org | | dmj+@andrew.cmu.edu |
\--------------------------------/ \--------------------------------/
--- gcc.c.orig Wed Jul 21 20:11:54 1999
+++ gcc.c Wed Jul 21 20:13:43 1999
@@ -595,7 +595,7 @@
{
#if USE_CPPLIB
"%{E|M|MM:cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
- %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+ %{C} %{v} %{I*} %{P} %{$} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -605,7 +605,7 @@
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
- %{fleading-underscore} %{fno-leading-underscore}\
+ %{fleading-underscore} %{fno-leading-underscore} %{A*}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\
%{!E:%{!M:%{!MM:cc1 %i %1 \
@@ -631,7 +631,7 @@
%{!pipe:%g.s} %A\n }}}}"
#else /* ! USE_CPPLIB */
"cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
- %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+ %{C} %{v} %{I*} %{P} %{$} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -641,7 +641,7 @@
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
- %{fleading-underscore} %{fno-leading-underscore}\
+ %{fleading-underscore} %{fno-leading-underscore} %{A*}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1 %{!pipe:%g.i} %1 \
@@ -659,7 +659,7 @@
}},
{"-",
{"%{E:cpp -lang-c %{ansi:-std=c89} %{std*} %{nostdinc*}\
- %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+ %{C} %{v} %{I*} %{P} %{$} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -669,14 +669,14 @@
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
- %{fleading-underscore} %{fno-leading-underscore}\
+ %{fleading-underscore} %{fno-leading-underscore} %{A*}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}}\
%{!E:%e-E required when input is from standard input}"}},
{".h", {"@c-header"}},
{"@c-header",
{"%{!E:%eCompilation of header file requested} \
- cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+ cpp %{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\
@@ -686,7 +686,7 @@
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
- %{fleading-underscore} %{fno-leading-underscore}\
+ %{fleading-underscore} %{fno-leading-underscore} %{A*}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}"}},
{".i", {"@cpp-output"}},
@@ -707,7 +707,7 @@
%i %A\n }}}}"}},
{".S", {"@assembler-with-cpp"}},
{"@assembler-with-cpp",
- {"cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
+ {"cpp -lang-asm %{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I\
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
-$ %{!undef:%p %P} -D__ASSEMBLER__ \
@@ -715,7 +715,7 @@
%{ffast-math:-D__FAST_MATH__}\
%{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
- %{fleading-underscore} %{fno-leading-underscore}\
+ %{fleading-underscore} %{fno-leading-underscore} %{A*}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:%{!S:as %a %Y\