[cfe-dev] Warnings difference between gcc and clang

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 9 17:45:03 PDT 2015


On Fri, Oct 09, 2015 at 07:17:29PM -0500, Rocco Moretti via cfe-dev wrote:
> From my random outside user's perspective, order dependent options are a
> pain,
> especially when you're not constructing the command line manually, but
> rather using
> one put together in bits and pieces by a build system. On more than one
> occasion I
> have cursed at my computer because various (admittedly non-warning) options
> have
> been the wrong way around on the command line.

...and the reverse is also true. Options are *naturally* order
dependent. Just consider -Wfoo and -Wno-foo.

> I also don't see any insanity with this sort of behavior on multiple levels
> of warning groups -
> at least from a users' perspective. The options are taken as an unordered
> set, and the
> most specific version "wins". True, it may get confusing if you don't know
> which options are
> included with a group, but that's also true for the order dependent version
> and constructs like
> "-Wno-xxx -Wgroup". If anything, to me the order independent one would seem
> less confusing,
> as you don't ever get "I explicitly set -Wno-xxx! Why am I getting xxx
> warnings?!"

You are forgetting the implictation of having -Wno-group in the mix. So
given a random permution of -Wall, -Wgroup, -Wno-group, -Wmember and
-Wno-member, which one wins? I find a rule that says "right-most wins"
to be much simpler to remember than "-Wall wins, then right most of
-Wgroup / -Wno-group, otherwise right most of -Wmember / -Wno-member". 

Joerg



More information about the cfe-dev mailing list