[cfe-dev] Warnings from macro expansions vs system headers

Eli Friedman eli.friedman at gmail.com
Thu Nov 8 17:22:06 PST 2012


On Thu, Nov 8, 2012 at 2:15 PM, Sean McBride <sean at rogue-research.com> wrote:
> Hi all,
>
> Is it expected that I get a warning from this, since the macro expansion happens in my source file, despite the "buggy" macro contents being in a system header?  (I filed <rdar://12665902> against the header regardless BTW.)

Handling macros is generally tricky, because they tend to violate
abstraction layers in a way that normal declarations do not: e.g. you
might not want a diagnostic here, but you want one if you write
MIN(1<<31, 0).  Occasionally, we will special-case certain
diagnostics, but we generally assume that if the expansion location is
in user code, we should warn as if it's user code.  Realistically,
this sort of thing is rare, so we can get away with this.

-Eli



More information about the cfe-dev mailing list