commit e45b2c33e616d47b610082911679846e909a1a68
parent ed7ff26f38bf305e450f0b1dc7e9f72dc9bf174c
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Tue, 16 Dec 2025 15:44:35 +0100
MbedTLS backend: muted compiler warnings in mbedtls headers
Diffstat:
3 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -590,6 +590,21 @@ MHD_CHECK_CC_CFLAG([-Wused-but-marked-unused],[CFLAGS_ac],
AC_DEFINE([[HAVE_WUSED_BUT_MARKED_UNUSED]],[[1]],[Define to '1' i][f -Wused-but-marked-unused flag is supported by compiler])
]
)
+MHD_CHECK_CC_CFLAG([-Wzero-as-null-pointer-constant],[CFLAGS_ac],
+ [
+ AC_DEFINE([[HAVE_WZERO_AS_NULL_POINTER_CONSTANT]],[[1]],[Define to '1' i][f -Wzero-as-null-pointer-constant flag is supported by compiler])
+ ]
+)
+MHD_CHECK_CC_CFLAG([-Wredundant-decls],[CFLAGS_ac],
+ [
+ AC_DEFINE([[HAVE_WREDUNDANT_DECLS]],[[1]],[Define to '1' i][f -Wredundant-decls flag is supported by compiler])
+ ]
+)
+MHD_CHECK_CC_CFLAG([-Wswitch-enum],[CFLAGS_ac],
+ [
+ AC_DEFINE([[HAVE_WSWITCH_ENUM]],[[1]],[Define to '1' i][f -Wswitch-enum flag is supported by compiler])
+ ]
+)
AS_UNSET([nocxx_compat_CFLAGS])
MHD_CHECK_CC_CFLAG([-Wc++-compat],[CFLAGS_ac],
[
diff --git a/src/include/microhttpd2_portability.h b/src/include/microhttpd2_portability.h
@@ -327,6 +327,7 @@
* 'pragma push/pop' support was added in GCC 4.6.0 */
# define MHD_WARN_PUSH_ _Pragma("GCC diagnostic push")
# define MHD_WARN_POP_ _Pragma("GCC diagnostic pop")
+# define MHD_WARN_IGNORE_STYLE_GCC 1
# define MHD_WARN_IGNORE_(warn) \
_Pragma(MHD_MACRO_STR_(GCC diagnostic ignored warn))
# ifdef MHD_USE_VARARG_MACROS_EXT
@@ -352,6 +353,7 @@
# elif MHD_CLANG_MINV (3,1)
# define MHD_WARN_PUSH_ _Pragma("clang diagnostic push")
# define MHD_WARN_POP_ _Pragma("clang diagnostic pop")
+# define MHD_WARN_IGNORE_STYLE_GCC 1
# define MHD_WARN_IGNORE_(warn) \
_Pragma(MHD_MACRO_STR_(clang diagnostic ignored warn))
# ifdef MHD_USE_VARARG_MACROS_EXT
diff --git a/src/mhd2/tls_mbed_tls_lib.h b/src/mhd2/tls_mbed_tls_lib.h
@@ -51,6 +51,24 @@
#error This header can be used only if MbedTLS is enabled
#endif
+#include "microhttpd2_portability.h"
+
+#if defined(MHD_WARN_IGNORE_STYLE_GCC)
+MHD_WARN_PUSH_
+# ifdef HAVE_WZERO_AS_NULL_POINTER_CONSTANT
+MHD_WARN_IGNORE_ ("-Wzero-as-null-pointer-constant")
+# endif /* HAVE_WZERO_AS_NULL_POINTER_CONSTANT */
+# ifdef HAVE_WREDUNDANT_DECLS
+MHD_WARN_IGNORE_ ("-Wredundant-decls")
+# endif /* HAVE_WREDUNDANT_DECLS */
+# ifdef HAVE_WSWITCH_ENUM
+MHD_WARN_IGNORE_ ("-Wswitch-enum")
+# endif /* HAVE_WSWITCH_ENUM */
+# define mhd_RESTORE_MBEDTLS_MUTED_WARNS MHD_WARN_POP_
+#else /* ! MHD_WARN_IGNORE_STYLE_GCC */
+# define mhd_RESTORE_MBEDTLS_MUTED_WARNS /* empty */
+#endif /* ! MHD_WARN_IGNORE_STYLE_GCC */
+
#include <mbedtls/build_info.h>
#include <mbedtls/platform.h>
#ifdef MBEDTLS_VERSION_C
@@ -194,4 +212,6 @@
# include <mbedtls/debug.h>
#endif
+mhd_RESTORE_MBEDTLS_MUTED_WARNS
+
#endif /* ! MHD_TLS_MBED_TLS_LIB_H */