On Thu, Nov 28, 2013 at 11:39 PM, Lennart Poettering
<lenn...@poettering.net> wrote:
> On Thu, 28.11.13 00:54, Zbigniew Jędrzejewski-Szmek 
> (zbys...@kemper.freedesktop.org) wrote:
>
>> commit f1a1264d13b31b9f5521f482d9a5a9d78da55efb
>> Author: Zbigniew J??drzejewski-Szmek <zbys...@in.waw.pl>
>> Date:   Thu Nov 28 03:41:33 2013 -0500
>>
>>     build-sys: avoid warnings from assert_cc
>>
>> diff --git a/configure.ac b/configure.ac
>> index c0656f4..f1b00c5 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -128,7 +128,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
>>          -Wold-style-definition \
>>          -Wpointer-arith \
>>          -Winit-self \
>> -        -Wdeclaration-after-statement \
>>          -Wfloat-equal \
>>          -Wmissing-prototypes \
>>          -Wstrict-prototypes \
>>
>
> I reverted this bit. Newer GCC versions don't suffer by this problem,
> and I think the warning makes a lot of sense on those.
>
> Instead we should add some code to macro.h which turns off the the
> warning with the #pragma stuff only if it detects it is being run on an
> old gcc.
>
> I would have just added this on my own, but I can't test this, since my
> gcc is new enough to not need this.
>
> gcc 4.8.2 (which is what Fedora 20 is using) works fine. So I would
> suggest some ifdef check in macro.h that uses #pragma to globally turn
> off the warning if anything < 4.8.2 i used...

Actually with anything newer or equal to gcc 4.6 we should be using
_Static_assert that's C11. systemd already checks if "static_assert"
is defined, which should work fine. I'm not sure if it's being
disabled depending on the build options due to the check in assert.h
(in Arch i'm getting the C11 behavior):

#if defined __USE_ISOC11 && !defined __cplusplus
/* Static assertion.  Requires support in the compiler.  */
# undef static_assert
# define static_assert _Static_assert
#endif

In kmod I'm checking by _Static_assert availability in configure and
defining a slightly different assert_cc macro for older compilers,
which appears to not show any warnings there, too.

Lucas De Marchi
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to