When I compile this simple C file:

#include <stddef.h>
int main() {
  return '\1\2';
}

I get a warning:

foo.c:3:10: warning: multi-character character constant

When I compile the same file using --save-temps, I do not get a warning. 
Similarly, if I use -E to produce a preprocessed file, and compile that, I do
not get a warning.  This is a bug: options like --save-temps and -E should not
affect the set of warnings which are issued.

However ,I noticed that I do get a warning if I compile with --save-temps
-Wsystem-headers.

This appears to be a bug in libcpp: when a line directive indicates that it is
entering a system header file, it records the current state.  However, it
apparently does not restore the old state when it exits the system header file.
 The effect is that preprocessor warnings and errors are suppressed in a .i
file if a system header file is included.


-- 
           Summary: gcc --save-temps does not give "multi-character
                    character constant" error
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com


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

Reply via email to