summaryrefslogtreecommitdiffstats
path: root/gl/m4/stdalign.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:38:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:38:58 +0000
commit54a043ffd13f3d896b58c6a9f0a4a5bb2170b9ab (patch)
tree1d8aa5f85a9450353ec3fdaaa5100f60c2d6478e /gl/m4/stdalign.m4
parentAdding debian version 2.12.0-4. (diff)
downloadman-db-54a043ffd13f3d896b58c6a9f0a4a5bb2170b9ab.tar.xz
man-db-54a043ffd13f3d896b58c6a9f0a4a5bb2170b9ab.zip
Merging upstream version 2.12.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gl/m4/stdalign.m4')
-rw-r--r--gl/m4/stdalign.m418
1 files changed, 12 insertions, 6 deletions
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index 1a236d6..2efd5f9 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -1,6 +1,6 @@
# Check for alignas and alignof that conform to C23.
-dnl Copyright 2011-2023 Free Software Foundation, Inc.
+dnl Copyright 2011-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -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
@@ -110,7 +112,11 @@ AC_DEFUN([gl_ALIGNASOF],
# define _Alignof(type) alignof (type)
# else
template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__
+# define _Alignof(type) __builtin_offsetof (__alignof_helper<type>, __b)
+# else
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+# endif
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# else
@@ -166,7 +172,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 +181,7 @@ AC_DEFUN([gl_ALIGNASOF],
# endif
# endif
-# if _GL_STDALIGN_NEEDS_STDDEF
+# if defined _GL_STDALIGN_NEEDS_STDDEF
# include <stddef.h>
# endif
#endif])