[PATCH] Do not use "1" in linemarker for main file in -frewrite-includes
Jordan Rose
jordan_rose at apple.com
Fri Apr 4 09:14:07 PDT 2014
I don't know what else this would interact with, so this is not an approval, but I think it's a good idea. We've gotten at least one bug report about this already, PR18948.
Jordan
On Apr 4, 2014, at 3:09 , Lubos Lunak <l.lunak at centrum.cz> wrote:
>
> The -frewrite-includes flag incorrectly uses at the beginning a linemarker
> for the main file with the "1" flag which suggests that the contents have
> been in fact included from another file. This for example
> disables -Wunused-macros, which warns only for macros from the main file:
>
> $ cat a.cpp
> #define FOO 1
> $ clang++ -E -frewrite-includes a.cpp | clang++ -Wall -Wunused-macros -x
> c++ -c -
> $ clang++ -Wall -Wunused-macros -c a.cpp
> a.cpp:1:9: warning: macro is not used [-Wunused-macros]
> #define FOO 1
> ^
> 1 warning generated.
>
> The attached patch fixes the code to start the resulting file with the
> correct linemarker.
>
> --
> Lubos Lunak
> <0001-do-not-use-1-for-line-marker-for-the-main-file.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list