[cfe-dev] Warnings difference between gcc and clang

Rocco Moretti via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 9 17:17:29 PDT 2015


On Fri, Oct 9, 2015 at 6:21 PM, Joerg Sonnenberger via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On Fri, Oct 09, 2015 at 07:09:22PM -0400, Edward Diener via cfe-dev wrote:
> > >Does GCC really allow -Wno-xxx flags that /precede/ -Wall on the command
> > >line to override -Wall? That seems broken.
> >
> > Yes, but it is not broken. According to gcc's documentation that is the
> way
> > it should be. The gcc compiler is not order sensitive in allowing a
> specific
> > compiler warning to override a general compiler warning. Therefore a
> > specific -Wno-xxx warning will override a -Wall or -Wextra warning no
> matter
> > where on the command line a specific warning is in relation to the
> general
> > warning.
>
> Just because someone had the brilliant idea to implement it that way
> doesn't mean others agree. Most important, the GCC behavior starts to
> show its insanity as soon as you have multiple levels of warning groups.
>


>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.

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?!"

Just my two cents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151009/ec9093d9/attachment.html>


More information about the cfe-dev mailing list