This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: patch: don't issue -Wreorder warnings when order doesn't matter


2011/7/29 Daniel Marjamäki <daniel.marjamaki@gmail.com>:
> Hello!
>
>> Why doesn't it matter in this case but it matters when the initializer
>> are non-constant?
>
> It doesn't matter because the program will behave the same no matter
> if the initializations are reordered or not. Logically it will behave
> just as the user expects no matter if he expects reordering or not.
>
> When one initializer is non-constant there might be a dependency
> between the two initializations and the wrong order might be a bug.
> I would like to silence such warnings also, but I don't want to try to
> determine if there is dependencies or not.
>
>
>> If you don't want to fix up your code, just compile it with -Wno-reorder.
>
> I don't want to use -Wno-reorder , because then I won't see the real
> problems. Don't get me wrong, I like this check.
>
>
> When gcc generates noise I think it is better to fix gcc than to fix my code.

It's not noise - the warning is useful in it current form.

> The only reason I can think of to keep this noise is for purely
> stylistic reasons. Somebody might think it is a stylistic problem to
> initialize members backwards. But then -Wreorder should also warn
> about common assignments and I doubt anybody wants that.

This is not a stylistic issue, it is about finding potential problems
as early as possible. I want to know the mem-initializers are in the
wrong order ASAP so I can correct them immediately, not when I change
the initializer to a non-constant.

What reason do you have for NOT fixing your code when the initializers
are in the wrong order?  The code might behave as expected, but it's
still misleading to write the mem-initializers in one order if the
compiler ignores it and uses a different order.

I would object to changing the behaviour, or if it changes then it
should be controllable so I can continue to get the current behaviour,
e.g. -Wreorder=0 does what you propose, -Wreorder=1 does what we have
now, and -Wreorder is equivalent to -Wreorder=1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]