gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: Moved some logic from 'configure'


From: gnunet
Subject: [libmicrohttpd] branch master updated: Moved some logic from 'configure' to 'mhd_align.h'
Date: Mon, 13 Sep 2021 20:01:07 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new b6dbca76 Moved some logic from 'configure' to 'mhd_align.h'
b6dbca76 is described below

commit b6dbca7699c79335c2d904700be4fe77ac41bdd3
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Sep 13 21:00:54 2021 +0300

    Moved some logic from 'configure' to 'mhd_align.h'
    
    This should improve readability and maintainability of the code.
---
 configure.ac               |  7 -------
 src/microhttpd/mhd_align.h | 30 +++++++++++++++++++++---------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5a5b82f0..0ac7b6b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -308,13 +308,6 @@ AC_CACHE_CHECK([[for C11 'alignof()' support]], 
[[mhd_cv_c_alignof]],
 #include <stdalign.h>
 #endif
         ]], [[
-#if (defined (__GNUC__) && __GNUC__ < 4 && __GNUC_MINOR__ < 9 && ! 
defined(__clang__)) || \
-    (defined (__clang__) && __clang_major__ < 8)
-/* GCC before 4.9 and clang before 8.0 have incorrect implementation of 
'alignof()'
-   which returns preferred alignment instead of minimal required alignment */
-#error Compiler has incorrect implementation of alignof()
-choke me now
-#endif
           int var1[(alignof(int) >= 2) ? 1 : -1];
           int var2[alignof(unsigned int) - 1];
           int var3[(alignof(char) > 0) ? 1 : -1];
diff --git a/src/microhttpd/mhd_align.h b/src/microhttpd/mhd_align.h
index c570eaa7..4169236f 100644
--- a/src/microhttpd/mhd_align.h
+++ b/src/microhttpd/mhd_align.h
@@ -33,24 +33,36 @@
 #endif
 
 #ifdef HAVE_C_ALIGNOF
-
 #ifdef HAVE_STDALIGN_H
 #include <stdalign.h>
-#endif
-
+#endif /* HAVE_STDALIGN_H */
 #define _MHD_ALIGNOF(type) alignof(type)
-
 #endif /* HAVE_C_ALIGNOF */
 
 #ifndef _MHD_ALIGNOF
-#if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER >= 1900
-/* MSVC has the same problem as older GCC versions:
-   '__alignof()' may return "preferred" alignment instead of "required",
-   but it is related to floating point variables only. */
+#if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER >= 1700
 #define _MHD_ALIGNOF(type) __alignof(type)
 #endif /* _MSC_VER >= 1900 */
 #endif /* !_MHD_ALIGNOF */
 
+#ifdef _MHD_ALIGNOF
+#if (defined (__GNUC__) && __GNUC__ < 4 && __GNUC_MINOR__ < 9 && \
+  ! defined(__clang__)) || \
+  (defined (__clang__) && __clang_major__ < 8) || \
+  (defined (__clang__) && __clang_major__ < 11 && \
+  defined(__apple_build_version__))
+/* GCC before 4.9 and clang before 8.0 have incorrect implementation of 
'alignof()'
+   which returns preferred alignment instead of minimal required alignment */
+#define _MHD_ALIGNOF_UNRELIABLE 1
+#endif
+
+#if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER < 1900
+/* MSVC has the same problem as old GCC versions:
+   '__alignof()' may return "preferred" alignment instead of "required". */
+#define _MHD_ALIGNOF_UNRELIABLE 1
+#endif /* _MSC_VER < 1900 */
+#endif /* _MHD_ALIGNOF */
+
 
 #ifdef offsetof
 #define _MHD_OFFSETOF(strct, membr) offsetof(strct, membr)
@@ -61,7 +73,7 @@
 
 /* Provide a limited set of alignment macros */
 /* The set could be extended as needed */
-#ifdef _MHD_ALIGNOF
+#if defined(_MHD_ALIGNOF) && ! defined(_MHD_ALIGNOF_UNRELIABLE)
 #define _MHD_UINT32_ALIGN _MHD_ALIGNOF(uint32_t)
 #define _MHD_UINT64_ALIGN _MHD_ALIGNOF(uint64_t)
 #else  /* ! _MHD_ALIGNOF */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]