[systemd-devel] [PATCH] Do not warn on declaration-after-statement

Lennart Poettering lennart at poettering.net
Fri Jan 17 09:58:01 PST 2014


On Fri, 17.01.14 18:25, misc at zarb.org (misc at zarb.org) wrote:

> From: Michael Scherer <misc at zarb.org>
> 
> There is currently around 20 instances of the warning shown when compiling
> systemd on Fedora 20, and no one seems to correct them. As this is a valid
> C code for C99 and gcc support C99 since 3.0 ( ie more than 10 years ), it
> may not be worth showing this warning.

We generally try to avoid declarations after statements in our coding
style, which is the reason why this warning is on. Note that this
warning you see only happens on some gcc versions, i.e. versions where
C11 static_assert()s is new. Older versions which lack support for it,
and newer versions will not generate the warning.

I am hence inclined to leave this on, really...

> ---
>  configure.ac | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 939ba6d..3a21a77 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -127,7 +127,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
>          -Wold-style-definition \
>          -Wpointer-arith \
>          -Winit-self \
> -        -Wdeclaration-after-statement \
>          -Wfloat-equal \
>          -Wsuggest-attribute=noreturn \
>          -Wmissing-prototypes \


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list