From mboxrd@z Thu Jan 1 00:00:00 1970 From: kevin_collins@my-deja.com To: help-gcc@gnu.org Subject: gcc -C acts different between 2.7.2.2 and 2.95.2 Date: Mon, 22 Nov 1999 09:52:00 -0000 Message-id: <81bv3g$8rp$1@nnrp1.deja.com> X-SW-Source: 1999-11/msg00338.html I am reposting this with more information. Any help would be appreciated. We are seeing different output when using 'gcc -E -C -P -undef' on the same file with gcc versions 2.7.2.2 and 2.95.2. Here is an example illustrating the difference. Source (xxx.c) : -- #define XYZ_ABC /* Define XYZ_ABC */ #ifdef ABC_XYZ /* ifdef ABC_XYZ */ #define ABC_XYZ_DEFINED #endif /* endif ABC_XYZ */ main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- 2.7.2.2 output: -- # gcc -E -C -P -undef xxx.c main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- 2.95.2 output: -- # gcc -E -C -P -undef xxx.c /* Define XYZ_ABC */ /* ifdef ABC_XYZ *//* endif ABC_XYZ */ main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- So the question is - which of these behaviors is correct? We are using gcc to parse files that are NOT C source and thus '/* */' structures for comments are invalid. However, because we only want the pre-processor to handle the directives, we don't want it to get rid of anything because it "thinks" its a C comment. Comments? Thanks, Kevin Sent via Deja.com http://www.deja.com/ Before you buy. From mboxrd@z Thu Jan 1 00:00:00 1970 From: kevin_collins@my-deja.com To: help-gcc@gnu.org Subject: gcc -C acts different between 2.7.2.2 and 2.95.2 Date: Tue, 30 Nov 1999 23:28:00 -0000 Message-ID: <81bv3g$8rp$1@nnrp1.deja.com> X-SW-Source: 1999-11n/msg00338.html Message-ID: <19991130232800.XeChzGv1IBZgjlWoxgINIwyswVQrscomfynFiGO5IPU@z> I am reposting this with more information. Any help would be appreciated. We are seeing different output when using 'gcc -E -C -P -undef' on the same file with gcc versions 2.7.2.2 and 2.95.2. Here is an example illustrating the difference. Source (xxx.c) : -- #define XYZ_ABC /* Define XYZ_ABC */ #ifdef ABC_XYZ /* ifdef ABC_XYZ */ #define ABC_XYZ_DEFINED #endif /* endif ABC_XYZ */ main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- 2.7.2.2 output: -- # gcc -E -C -P -undef xxx.c main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- 2.95.2 output: -- # gcc -E -C -P -undef xxx.c /* Define XYZ_ABC */ /* ifdef ABC_XYZ *//* endif ABC_XYZ */ main() { printf ("this is a string\n"); /* printf */ /* comment only here */ } -- So the question is - which of these behaviors is correct? We are using gcc to parse files that are NOT C source and thus '/* */' structures for comments are invalid. However, because we only want the pre-processor to handle the directives, we don't want it to get rid of anything because it "thinks" its a C comment. Comments? Thanks, Kevin Sent via Deja.com http://www.deja.com/ Before you buy.