[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] verify: use _Static_assert if available
From: |
Eric Blake |
Subject: |
Re: [PATCH] verify: use _Static_assert if available |
Date: |
Tue, 05 Apr 2011 14:45:06 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 |
On 04/04/2011 08:26 PM, Paul Eggert wrote:
> This gnulib patch modifies "verify" to use C1X's _Static_assert if
> running GCC 4.6.0 or later, which generates easier-to-read
> diagnostics. I haven't pushed this yet because I thought it wouldn't
> hurt to get more pairs of eyes to look at it.
Cool idea, and makes it so we never have to worry about future gcc
warning-sensitivity changes!
>
> +/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
> + C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and
> + later, and its use here generates easier-to-read diagnostics when
> + verify (R) fails.
> +
> + For now, use this with a non-GCC compiler only if __STDC_VERSION__
> + is a high value. The value that will be chosen for C1X is not
> + known yet, but guess that it's at least 201104. Eventually whether
> + _Static_assert works should be determined by 'configure'. */
> +# if (201104 <= __STDC_VERSION__ \
> + || 4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__))
> +# define HAVE__STATIC_ASSERT 1
> +# endif
Looks good for now; we can always tweak it if future practice shows
otherwise (such as, as you say, adding a configure check).
I think you can go ahead and commit it.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature