From: Paul Eggert Date: Fri, 2 Dec 2011 09:34:53 +0000 (-0800) Subject: stdalign: port to Clang 3.0 X-Git-Tag: v0.1~1386 X-Git-Url: https://erislabs.net/gitweb/?a=commitdiff_plain;h=772abedb9a99cf42fffddb99749e1294b902be3c;hp=6b93d00f5410ec183e3a70ebf8e418e3b1bb0191;p=gnulib.git stdalign: port to Clang 3.0 Problem reported by Simon Josefsson in . * doc/posix-headers/stdalign.texi (stdalign.h): Mention Clang 3.0, which has but which does not define alignof. * m4/stdalign.m4 (gl_STDALIGN_H): Check for Clang 3.0's problem. --- diff --git a/ChangeLog b/ChangeLog index 5a616e7bc..1cb710a58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-12-02 Paul Eggert + + stdalign: port to Clang 3.0 + Problem reported by Simon Josefsson in + . + * doc/posix-headers/stdalign.texi (stdalign.h): Mention Clang 3.0, + which has but which does not define alignof. + * m4/stdalign.m4 (gl_STDALIGN_H): Check for Clang 3.0's problem. + 2011-12-01 Eric Blake mktempd: silence dd usage diff --git a/doc/posix-headers/stdalign.texi b/doc/posix-headers/stdalign.texi index b3d39f05c..bebc70d46 100644 --- a/doc/posix-headers/stdalign.texi +++ b/doc/posix-headers/stdalign.texi @@ -13,6 +13,8 @@ Portability problems fixed by Gnulib: @itemize @item This header file is missing on most circa-2011 platforms. +@item +Clang 3.0's @code{} does not define @code{alignof}/@code{_Alignof}. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index da64dc633..2641dce51 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -9,9 +9,24 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDALIGN_H], [ - AC_CHECK_HEADERS_ONCE([stdalign.h]) + AC_CACHE_CHECK([for working stdalign.h], + [gl_cv_header_working_stdalign_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int align_int = alignof (int) + _Alignof (double); - if test $ac_cv_header_stdalign_h = yes; then + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + (__GNUC__ || __IBMC__ || __IBMCPP__ \ + || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) + int alignas (8) alignas_int = 1; + #endif + ]])], + [gl_cv_header_working_stdalign_h=yes], + [gl_cv_header_working_stdalign_h=no])]) + + if test $gl_cv_header_working_stdalign_h = yes; then STDALIGN_H='' else STDALIGN_H='stdalign.h'