[PATCH] Fix "In file included from" for files generated with -frewrite-includes

Richard Smith richard at metafoo.co.uk
Fri Apr 11 16:00:54 PDT 2014


Makes perfect sense, and patch LGTM. Thanks!


On Fri, Apr 4, 2014 at 3:16 AM, Lubos Lunak <l.lunak at centrum.cz> wrote:

>
>  Option -frewrite-includes comments out #include directives it replaces by
> enclosing it in #if 0, which moves the included contents, changing their
> perceived line numbers e.g. in the "In file included from" messages in a
> follow-up compilation:
>
> $ cat b.cpp
> #include "b.h"
> $ cat b.h
> void f()
>     {
>     int unused_variable;
>     }
> $ clang++ -E -frewrite-includes b.cpp | clang++ -Wall -x c++ -c -
> In file included from b.cpp:4:
> ./b.h:3:9: warning: unused variable 'unused_variable' [-Wunused-variable]
>     int unused_variable;
>         ^
> 1 warning generated.
> $ clang++ -Wall -c b.cpp
> In file included from b.cpp:1:
> ./b.h:3:9: warning: unused variable 'unused_variable' [-Wunused-variable]
>     int unused_variable;
>         ^
> 1 warning generated.
>
>  The attached patch fixes this.
>
> --
>  Lubos Lunak
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140411/24c2ef2d/attachment.html>


More information about the cfe-commits mailing list