[cfe-dev] Warnings are different on preprocessed file

Lubos Lunak l.lunak at centrum.cz
Wed Mar 12 09:54:12 PDT 2014


On Wednesday 12 of March 2014, Richtarsky, Martin wrote:
> Hi,
>
> is this expected behavior?
...
> #define CHECK(a) ( a ? 1 : NULL)
>
> int func1()
> {
>     int a;
>     return NULL; // produces warning during direct compilation and
> compilation of preprocessed source }
>
> int func2()
> {
>     int a;
>     return (CHECK(a)); // produces warning only on preprocessed source
> }

 http://llvm.org/viewvc/llvm-project?view=revision&revision=156861

 That's not the only case when Clang suppresses a warning for something coming 
from a macro, so a separate preprocessing step results in a warning that 
wouldn't be otherwise reported. On the other hand, why would one actually 
need a separate preprocessing step for normal usage in practice anyway.

-- 
 Lubos Lunak



More information about the cfe-dev mailing list