[Top][All Lists]

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

Re: [sr #107896] gnutls 3.0.8 fails to compile with clang

From: Paul Eggert
Subject: Re: [sr #107896] gnutls 3.0.8 fails to compile with clang
Date: Fri, 02 Dec 2011 01:43:01 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0

Thanks, I tried to fix that by pushing the following patch;
please give it a try.

I had tested with Clang before, but I was using Clang 2.x
and the problem is new to Clang 3.x (which I don't have).

It strikes me, though, that this sort of approach cannot work if
<stdalign.h> is installed into a directory intended to be used by
shared libraries or whatnot.  This is because the compiler used in the
configure-time test for <stdalign.h> may not be the same as the
compiler used later, when the shared library is compiled against.
I expect that this isn't the only place where gnulib has this problem,
though, and since it's purely theoretical right now for stdalign.h
I didn't pursue it.

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 <stdalign.h> but which does not define alignof.
* m4/stdalign.m4 (gl_STDALIGN_H): Check for Clang 3.0's problem.
diff --git a/doc/posix-headers/stdalign.texi b/doc/posix-headers/stdalign.texi
index b3d39f0..bebc70d 100644
--- a/doc/posix-headers/stdalign.texi
+++ b/doc/posix-headers/stdalign.texi
@@ -13,6 +13,8 @@ Portability problems fixed by Gnulib:
 This header file is missing on most circa-2011 platforms.
+Clang 3.0's @code{<stdalign.h>} 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 da64dc6..2641dce 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -9,9 +9,24 @@ dnl with or without modifications, as long as this notice is 

-  AC_CHECK_HEADERS_ONCE([stdalign.h])
+  AC_CACHE_CHECK([for working stdalign.h],
+    [gl_cv_header_working_stdalign_h],
+          [[#include <stdalign.h>
+            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

reply via email to

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