This is the mail archive of the gcc-bugs@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]

[Bug preprocessor/12952] New: gcc -g3 -E sometimes doesn't emit #undef's


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12952

           Summary: gcc -g3 -E sometimes doesn't emit #undef's
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at techfak dot uni-bielefeld dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8

gcc -g3 -E (which emits both macro definitions and #undef's and the
expanded text) is a very useful debugging tool to determine why some code
behaves unexpected after preprocessing.  Unfortunately, #undef's aren't
emitted under some circumstances, which can be very confusing in above
debugging situation where you try to determine if/where some macro gets
undefined before or after a previous definition.

Environment:
System: SunOS xayide 5.10 s10_42 sun4u sparc SUNW,Ultra-1
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: /vol/gnu/src/gcc/gcc/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls

How-To-Repeat:
$ cat > def-undef.c
#define HELLO
#undef HELLO
$ cat > undef.c
#undef HELLO
$ ./xgcc -B./ -g3 -E def-undef.c
[...]
# 1 "<command line>"
# 1 "def-undef.c"
#define HELLO 
#undef HELLO
$ ./xgcc -B./ -g3 -E undef.c
[...]
# 1 "<command line>"
# 1 "undef.c"

As you can see, if there was a previous #define, the following #undef is
emitted, without the #define, the #undef is missing.  This is very
confusing and seems unnecessarily inconsistent.


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