bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] std-gnu11: improve clang support


From: Paul Eggert
Subject: [PATCH] std-gnu11: improve clang support
Date: Tue, 15 Mar 2016 13:10:08 -0700

* m4/std-gnu11.m4: Sync with autoconf, incorporating:
2016-03-15 Also try clang
2016-03-15 Port C11 and C++11 testing to clang
---
 ChangeLog       |  5 +++++
 m4/std-gnu11.m4 | 20 +++++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c3470b5..d71f8b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2016-03-15  Paul Eggert  <address@hidden>
 
+       std-gnu11: improve clang support
+       * m4/std-gnu11.m4: Sync with autoconf, incorporating:
+       2016-03-15 Also try clang
+       2016-03-15 Port C11 and C++11 testing to clang
+
        select: port more to Intel 2016.1.150 compiler
        Problem reported by Balázs Hajgató in:
        http://lists.gnu.org/archive/html/bug-gnulib/2016-03/msg00036.html
diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
index a687cdb..e8d3ebc 100644
--- a/m4/std-gnu11.m4
+++ b/m4/std-gnu11.m4
@@ -1,8 +1,8 @@
 # Prefer GNU C11 and C++11 to earlier versions.  -*- coding: utf-8 -*-
 
 # This implementation is taken from GNU Autoconf lib/autoconf/c.m4
-# commit 5ad3567c3cbd90b4faa6539c35bc4a8c6500f535
-# dated 2015-10-08 10:12:41 2015 +0200.
+# commit 739cdc82b5325402231f3f5e1a38f681fcbd1db2
+# dated Tue Mar 15 09:34:11 2016 -0700.
 # This implementation will be obsolete once we can assume Autoconf 2.70
 # or later is installed everywhere a Gnulib program might be developed.
 
@@ -58,6 +58,9 @@ fi
 if test -z "$CC"; then
   AC_CHECK_TOOLS(CC, cl.exe)
 fi
+if test -z "$CC"; then
+  AC_CHECK_TOOL(CC, clang)
+fi
 ])
 
 test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
@@ -123,7 +126,7 @@ if test -z "$CXX"; then
   else
     AC_CHECK_TOOLS(CXX,
                   [m4_default([$1],
-                              [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC 
xlC_r xlC])],
+                              [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC 
xlC_r xlC clang++])],
                   g++)
   fi
 fi
@@ -198,6 +201,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>
@@ -432,7 +436,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)
@@ -754,9 +760,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";
 }
 ]])
 
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]