commit d2621aaf14d7cba14e425112fd00d017ef018b1c
parent 04a1e1ec498b6f875a94fe22dc7747e729f2b816
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Mon, 22 Dec 2025 13:35:59 +0100
Added guards to enforce the correct order of included headers
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -57,6 +57,11 @@ MHD_LIBDEPS=""
MHD_REQ_PRIVATE=''
MHD_LIBDEPS_PKGCFG=''
+AH_TOP([#ifndef MHD_SYS_OPTIONS_H
+#error "mhd_config.h" must never be used directly
+#error include "mhd_sys_options.h" wrapper instead
+#endif /* ! MHD_SYS_OPTIONS_H */])
+
AS_IF([test -z "$CC" && test -z "$CPP"], [
AC_MSG_CHECKING([[whether z/OS special settings are required]])
AS_IF([test `uname -s` = "OS/390"],
diff --git a/src/incl_priv/mhd_sys_options.h b/src/incl_priv/mhd_sys_options.h
@@ -53,6 +53,10 @@
#ifndef MHD_SYS_OPTIONS_H
#define MHD_SYS_OPTIONS_H 1
+#if defined(MICROHTTPD2_H) || defined(MICROHTTPD2_PORTABILITY_H)
+#error the header "mhd_sys_options.h" must be included before any other header
+#endif
+
#ifndef HAVE_CONFIG_H
# ifndef _MSC_VER
#error HAVE_CONFIG_H must be defined