diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-03-15 08:56:43 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-03-15 08:57:10 -0700 |
commit | 12aec07e44e2a37f4081a7a40dba51574999613b (patch) | |
tree | 402be8052fa7f2c7e136a1700d0e19b6fe9c7c3b | |
parent | 6236291e58d8c63ae3530caa01c5d363af2291ae (diff) | |
download | autoconf-12aec07e44e2a37f4081a7a40dba51574999613b.tar.gz |
Port C11 and C++11 testing to clang
* lib/autoconf/c.m4 (_AC_C_C99_TEST_HEADER):
Include stddef.h, for offsetof.
(_AC_PROG_CC_C11): Limit _Static_assert to integer constant
expressions. Suggested by Nick Bowler in:
http://lists.gnu.org/archive/html/autoconf/2016-02/msg00009.html
(_AC_CXX_CXX11_TEST_BODY): Don't use string literals to initialize
non-const pointers. Suggested by Mike Miller in:
http://lists.gnu.org/archive/html/autoconf/2016-02/msg00008.html
-rw-r--r-- | lib/autoconf/c.m4 | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index fe87dbfa..933955f1 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -1205,6 +1205,7 @@ AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) AC_DEFUN([_AC_C_C99_TEST_HEADER], [[#include <stdarg.h> #include <stdbool.h> +#include <stddef.h> #include <stdlib.h> #include <wchar.h> #include <stdio.h> @@ -1439,7 +1440,9 @@ struct anonymous [_AC_C_C99_TEST_BODY[ v1.i = 2; v1.w.k = 5; - _Static_assert (&v1.i == &v1.w.k, "Anonymous union alignment botch"); + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); ]], dnl Try dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) @@ -2453,9 +2456,9 @@ AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], } { // Unicode literals - char *utf8 = u8"UTF-8 string \u2500"; - char16_t *utf16 = u"UTF-8 string \u2500"; - char32_t *utf32 = U"UTF-32 string \u2500"; + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; } ]]) |