]> Savannah Git Hosting - gnulib.git/commitdiff
alignasof, stdalign: Avoid some -Wundef warnings from config.h.
authorBruno Haible <bruno@clisp.org>
Thu, 3 Aug 2023 16:09:29 +0000 (18:09 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 16 Aug 2023 16:54:58 +0000 (18:54 +0200)
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00012.html>.

* m4/stdalign.m4 (gl_ALIGNASOF): Test whether __cplusplus is defined
before evaluating it. Assume HAVE_STDALIGN_H, _GL_STDALIGN_NEEDS_STDDEF
are never defined to 0.

ChangeLog
m4/stdalign.m4

index c2521c302e2bb34f024785fed198f8816d070f97..3b4fe93f87d0f45b4ede2eaa815e92b79d7d31e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-08-03  Bruno Haible  <bruno@clisp.org>
+
+       alignasof, stdalign: Avoid some -Wundef warnings from config.h.
+       Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00012.html>.
+       * m4/stdalign.m4 (gl_ALIGNASOF): Test whether __cplusplus is defined
+       before evaluating it. Assume HAVE_STDALIGN_H, _GL_STDALIGN_NEEDS_STDDEF
+       are never defined to 0.
+
 2023-07-31  Bruno Haible  <bruno@clisp.org>
 
        readutmp: Fix test failure on OpenBSD.
index 1a236d66d2f1098d2d9538a27ea6c9913f917d00..6a39ffe756581584e7b5aef891f876aafd412e43 100644 (file)
@@ -68,8 +68,10 @@ AC_DEFUN([gl_ALIGNASOF],
   dnl The "zz" puts this toward config.h's end, to avoid potential
   dnl collisions with other definitions.
   AH_VERBATIM([zzalignas],
-[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof
-# if HAVE_STDALIGN_H
+[#if !defined HAVE_C_ALIGNASOF \
+    && !(defined __cplusplus && 201103 <= __cplusplus) \
+    && !defined alignof
+# if defined HAVE_STDALIGN_H
 #  include <stdalign.h>
 # endif
 
@@ -166,7 +168,7 @@ AC_DEFUN([gl_ALIGNASOF],
 #   define _Alignas(a) __declspec (align (a))
 #  endif
 # endif
-# if !HAVE_STDALIGN_H
+# if !defined HAVE_STDALIGN_H
 #  if ((defined _Alignas \
         && !(defined __cplusplus \
              && (201103 <= __cplusplus || defined _MSC_VER))) \
@@ -175,7 +177,7 @@ AC_DEFUN([gl_ALIGNASOF],
 #  endif
 # endif
 
-# if _GL_STDALIGN_NEEDS_STDDEF
+# if defined _GL_STDALIGN_NEEDS_STDDEF
 #  include <stddef.h>
 # endif
 #endif])