Does anyone still feel strongly about -Wdeclaration-after-statement ?

Alan Coopersmith alan.coopersmith at oracle.com
Sun Sep 1 23:54:06 UTC 2024


On 8/15/24 01:15, Matthieu Herrb wrote:
> On Tue, Aug 13, 2024 at 01:56:14PM +0200, Enrico Weigelt, metux IT consult wrote:
>> On 08.08.24 13:37, Matthieu Herrb wrote:
>>
>>> But also try to avoid gratuitous churn. I'm opposed to commit to just
>>> move variable declaration around "because we can".
>>
>> You're referring to me, right ?
> 
> Not only, I have your current activity in mind, but there have
> been others in the past.

Certainly I've done many changes that move variable declarations around
in order to reduce their scope (including moving index declarations into
the start of the for loops) - I believe that makes it easier for the
humans reading the code to know what a variable affects, but it does
cause some churn.  I also did quite a few when converting to C99-style
struct initializations, which I do believe made the code better by
ensuring we filled all members of the struct while still keeping it
easy for humans to see which value was going into which field, unlike
the old C89 style where you had to match up the field order.

And churn like the major refactorings you've been doing does make it
harder to selectively backport fixes to older branches - the more you
change, the more you make it so that someday we'll have to start a new
branch for the non-wayland Xservers because we won't be able to easily
backport security fixes to the 21.1 branch any longer.  (Whether or not
that's a good thing, it is a cost we are going to have pay someday, and
one we aren't really ready to pay right now.)

Getting back to the original topic of this thread, I've posted an MR
to remove -Wdeclaration-after-statement from our default autoconf flags:
https://gitlab.freedesktop.org/xorg/util/macros/-/merge_requests/7

-- 
         -Alan Coopersmith-                 alan.coopersmith at oracle.com
          Oracle Solaris Engineering - https://blogs.oracle.com/solaris


More information about the xorg-devel mailing list