# HG changeset patch # User Bruno Haible # Date 1536266641 -7200 # Node ID 4bc6c3133bdd64c9577bd7ad57958ec7594df6d8 # Parent b07bc729e806ec8272dd4d5e2fbf81f4ece4f1df stddef: Override max_align_t on NetBSD 8.0/x86. * m4/stddef_h.m4 (gl_STDDEF_H): When testing for max_align_t, test also the value of __alignof__ (max_align_t). * doc/posix-headers/stddef.texi: Mention the issue. diff -r b07bc729e806 -r 4bc6c3133bdd ChangeLog --- a/ChangeLog Thu Sep 06 18:36:02 2018 +0200 +++ b/ChangeLog Thu Sep 06 22:44:01 2018 +0200 @@ -1,3 +1,10 @@ +2018-09-06 Bruno Haible + + stddef: Override max_align_t on NetBSD 8.0/x86. + * m4/stddef_h.m4 (gl_STDDEF_H): When testing for max_align_t, test also + the value of __alignof__ (max_align_t). + * doc/posix-headers/stddef.texi: Mention the issue. + 2018-09-06 Bruno Haible fcntl: Fix F_DUPFD_CLOEXEC behaviour on Haiku. diff -r b07bc729e806 -r 4bc6c3133bdd doc/posix-headers/stddef.texi --- a/doc/posix-headers/stddef.texi Thu Sep 06 18:36:02 2018 +0200 +++ b/doc/posix-headers/stddef.texi Thu Sep 06 22:44:01 2018 +0200 @@ -12,6 +12,10 @@ Solaris 11.0 and others. @item +@code{max_align_t} does not have the expected alignment on some platforms: +NetBSD 8.0/x86. + +@item Some old platforms fail to provide @code{wchar_t}. @item diff -r b07bc729e806 -r 4bc6c3133bdd m4/stddef_h.m4 --- a/m4/stddef_h.m4 Thu Sep 06 18:36:02 2018 +0200 +++ b/m4/stddef_h.m4 Thu Sep 06 22:44:01 2018 +0200 @@ -1,5 +1,5 @@ dnl A placeholder for , for platforms that have issues. -# stddef_h.m4 serial 5 +# stddef_h.m4 serial 6 dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,13 +10,33 @@ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) STDDEF_H= - AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h], - [[#include - ]]) + + dnl Test whether the type max_align_t exists and whether its alignment + dnl "is as great as is supported by the implementation in all contexts". + AC_CACHE_CHECK([for good max_align_t], + [gl_cv_type_max_align_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + ]])], + [gl_cv_type_max_align_t=yes], + [gl_cv_type_max_align_t=no]) + ]) + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi + if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -28,6 +48,7 @@ REPLACE_NULL=1 STDDEF_H=stddef.h fi + AC_SUBST([STDDEF_H]) AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then