changeset 17789:47c2be5d17f0

obstack: port to platforms that #define __alignof__ * lib/obstack.c: Include <alignof.h> if !defined __alignof__, not if !_LIBC. We don't know of any platforms that #define __alignof__, but it might be useful in tests. Conversely, glibc assumes GCC.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 03 Nov 2014 16:34:52 -0800
parents 6eb23dad34b3
children 1313252b8540
files ChangeLog lib/obstack.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+	obstack: port to platforms that #define __alignof__
+	* lib/obstack.c: Include <alignof.h> if !defined __alignof__,
+	not if !_LIBC.  We don't know of any platforms that #define
+	__alignof__, but it might be useful in tests.  Conversely,
+	glibc assumes GCC.
+
 2014-11-03  Pádraig Brady  <P@draigBrady.com>
 
 	linkat: don't unconditionally replace on GNU/Linux
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -48,7 +48,10 @@
 #endif
 
 #ifndef _OBSTACK_ELIDE_CODE
-# if !defined _LIBC && !defined __GNUC__
+/* If GCC, or if an oddball (testing?) host that #defines __alignof__,
+   use the already-supplied __alignof__.  Otherwise, this must be Gnulib
+   (as glibc assumes GCC); defer to Gnulib's alignof_type.  */
+# if !defined __GNUC__ && !defined __alignof__
 #  include <alignof.h>
 #  define __alignof__(type) alignof_type (type)
 # endif