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   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to