[cfe-commits] r162810 - in /cfe/trunk: include/clang/Lex/MacroInfo.h include/clang/Lex/Preprocessor.h lib/Frontend/PrintPreprocessedOutput.cpp lib/Lex/MacroInfo.cpp lib/Lex/PPDirectives.cpp lib/Lex/PPMacroExpansion.cpp lib/Lex/Pragma.cpp lib/Sema

Eli Friedman eli.friedman at gmail.com
Wed Aug 29 17:16:18 PDT 2012


On Wed, Aug 29, 2012 at 4:40 PM, Alexander Kornienko <alexfh at google.com> wrote:
> No, there was no intention to change behavior. But could you provide more
> details on this?

Just compile it with clang; before, it would fail to compile:
[...]gcc-4_2-testsuite/src/gcc.dg/cpp/mac-dir-1.c:27:15: error: too
many arguments provided to function-like macro invocation
     if (1 != f(2
              ^
[...]/gcc-4_2-testsuite/src/gcc.dg/cpp/mac-dir-1.c:27:15: error: use
of undeclared identifier 'f'

With your patch, it compiles without errors, but the compiled program
aborts.  For comparison, with gcc, the program compiles and runs
successfully.  (I'm pretty sure this is all undefined behavior per
C99, but it would be nice to be consistent with gcc.)

-Eli



More information about the cfe-commits mailing list