[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

Alexander Kornienko alexfh at google.com
Thu Aug 30 09:39:56 PDT 2012


Thank you for sorting this out and saving me from gdb-ing into it ;) I've
checked with the original test, works fine.

On Thu, Aug 30, 2012 at 6:41 AM, Richard Smith <richard at metafoo.co.uk>wrote:

> Neither the old nor new behavior is correct, according to the GCC
> specification for how directives within macro arguments should work. Should
> be fixed in r162906.
>
> On Wed, Aug 29, 2012 at 6:04 PM, Alexander Kornienko <alexfh at google.com>wrote:
>
>> +chandlerc, richardsmith, klimek, dgregor
>>
>> Yes, it's really my patch, but I'm not really sure if we want to fix this.
>>
>> Any idea of whether we should care about this behavior or not?
>>
>>
>> On Wed, Aug 29, 2012 at 5:48 PM, Alexander Kornienko <alexfh at google.com>wrote:
>>
>>> I'm not really sure if that was my patch, but I'm looking into it now.
>>>
>>> Anyone else has any preferences except compatibility with gcc?
>>>
>>>
>>> On Wed, Aug 29, 2012 at 5:16 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>>>
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Alex
>>>
>>
>>
>>
>> --
>> Regards,
>> Alex
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>


-- 
Alexander Kornienko | Software Engineer | alexfh at google.com | +49 151 221
77 957
Google Germany GmbH | Dienerstr. 12 | 80331 München
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120830/51035aab/attachment.html>


More information about the cfe-commits mailing list