From 936da5068adfee27edd05f29096dfa179d8db387 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 3 Aug 2023 18:09:29 +0200 Subject: [PATCH] alignasof, stdalign: Avoid some -Wundef warnings from config.h. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Tim Rühsen in . * 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 | 9 +++++++++ m4/stdalign.m4 | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2521c302e..3b4fe93f87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-08-03 Bruno Haible + + alignasof, stdalign: Avoid some -Wundef warnings from config.h. + Reported by Tim Rühsen in + . + * 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 readutmp: Fix test failure on OpenBSD. diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 1a236d66d2..6a39ffe756 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -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 # 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 # endif #endif]) -- 2.39.5