Add directives-only preprocessing

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Add directives-only preprocessing

Robinson, Paul via cfe-dev
Hello!

When using clang with distributed build systems various errors may occur due to clang compiles
source code differently if it was previously preprocessed(see [1] for example). Is it an intentional behaviour?

As a solution for this kind of errors gcc provides "-fdirectives-only" flag([2]) to preprocess only directives, but prevent macro expansions outside of directives, which also speedups preprocessing
on local machine. Are there any plans to support this kind of feature? Are patches welcome?


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add directives-only preprocessing

Robinson, Paul via cfe-dev
Clang already has -frewrite-includes for this purpose.

On Wed, May 17, 2017 at 7:30 AM, Matthew Larionov via cfe-dev <[hidden email]> wrote:
Hello!

When using clang with distributed build systems various errors may occur due to clang compiles
source code differently if it was previously preprocessed(see [1] for example). Is it an intentional behaviour?

As a solution for this kind of errors gcc provides "-fdirectives-only" flag([2]) to preprocess only directives, but prevent macro expansions outside of directives, which also speedups preprocessing
on local machine. Are there any plans to support this kind of feature? Are patches welcome?


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add directives-only preprocessing

Robinson, Paul via cfe-dev
If it actually does the same thing as GCC's -fdirectives-only, I'd be happy to review a patch to provide that as an alias.

On Wed, May 17, 2017 at 10:18 AM Reid Kleckner via cfe-dev <[hidden email]> wrote:
Clang already has -frewrite-includes for this purpose.

On Wed, May 17, 2017 at 7:30 AM, Matthew Larionov via cfe-dev <[hidden email]> wrote:
Hello!

When using clang with distributed build systems various errors may occur due to clang compiles
source code differently if it was previously preprocessed(see [1] for example). Is it an intentional behaviour?

As a solution for this kind of errors gcc provides "-fdirectives-only" flag([2]) to preprocess only directives, but prevent macro expansions outside of directives, which also speedups preprocessing
on local machine. Are there any plans to support this kind of feature? Are patches welcome?


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add directives-only preprocessing

Robinson, Paul via cfe-dev
In reply to this post by Robinson, Paul via cfe-dev
David Blaikie writes:

> If it actually does the same thing as GCC's -fdirectives-only, I'd be happy
> to review a patch to provide that as an alias.

No, they are quite different. GCC's -fdirectives-only expands all the
directives (#ifdef, #warning, etc) while Clang's -frewrite-includes only
expands #include's (it still evaluates #ifdef, etc but does not eliminate
branches not taken).

With GCC you will also need to pass -fdirectives-only to the compilation
stage while with Clang you treat it as a normal source file (so may need
-x c/c++ if compiling as .i/.ii).

Boris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...