[cfe-dev] Separate preprocess and compile: hack or feature?
Joerg Sonnenberger via cfe-dev
cfe-dev at lists.llvm.org
Thu May 11 05:50:25 PDT 2017
On Thu, May 11, 2017 at 11:05:43AM +0200, Boris Kolpackov via cfe-dev wrote:
> In the build system I am working on we are looking at always performing
> the preprocessing and then C/C++ compilation as two separate clang/clang++
> invocations. The main reason is support for distributed compilation but
> see here[1] for other reasons.
It is strongly recommented to *not* separate them. A lot of warnings are
sensitive to macros, i.e. will not trigger for patterns created by macro
use etc. A very basic example is
if (FOO(x))
will not warn, but if FOO(x) expands to (x) as recommented, you get
if ((x))
which will get a warning for double brackets without assignment. There
is the option of using the rewrite mode (-E -frewrite-includes), which
is somewhat of a compromise.
Joerg
More information about the cfe-dev
mailing list