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

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jul 29 00:48:45 UTC 2024


Back when we first added a default set of compiler warning flags to our
xorg-macros.m4 for autoconf in 2008, we included -Wdeclaration-after-statement
since not all the compilers at the time supported this C99 feature (most
notably some OpenBSD ports that used gcc 2.95, but also MSVC versions before
2013).

Since then we've widely adopted other C99 features such as struct initializers
and declaring variables in for loops ("for (int i = 0; ....)"), but last
time we discussed this warning in 2013, decided to leave it in place as
a style choice, not a technical constraint - see the thread starting at:
https://lists.freedesktop.org/archives/xorg-devel/2013-September/037735.html

But we didn't carry that flag over in our meson conversions - apparently
intentionally so in the case of the X server code base:
https://gitlab.freedesktop.org/xorg/xserver/-/commit/db465bae533f85e7f900deb96efecc831c9d550b
so people patching the X server don't get told that we don't like that style,
and so now Enrico has submitted a number of merge requests that use it to
simplify some of our previous code, such as:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1601

Do we want to keep insisting on this as part of our style, or have people
gotten used to it from other languages/projects now and are willing to
accept it in X.Org code?

Is it time to re-apply
https://gitlab.freedesktop.org/xorg/util/macros/-/commit/689ea0ec5d8b7594ba2fa9e27b2458cea8a58724
to util-macros?

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


More information about the xorg-devel mailing list