userspace_c_args += cc.get_supported_arguments(possible_cc_flags)
userspace_c_ld_args += cc.get_supported_link_arguments(possible_link_flags)
-have = cc.has_argument('-Wzero-length-bounds')
-conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
-
if cc.compiles('''
#include <time.h>
#include <inttypes.h>
cpp = ' '.join(cc.cmd_array() + get_option('c_args')) + ' -E'
+# new in GCC 10
+have = cc.has_argument('-Wzero-length-bounds')
+conf.set10('HAVE_WARNING_ZERO_LENGTH_BOUNDS', have)
+
+# new in GCC 15
+have = cc.has_argument('-Wzero-as-null-pointer-constant')
+conf.set10('HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT', have)
+
#####################################################################
# compilation result tests
endif
efi_conf = configuration_data()
+
+# import several configs from userspace
+foreach name : ['HAVE_WARNING_ZERO_LENGTH_BOUNDS', 'HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT']
+ efi_conf.set10(name, conf.get(name) == 1)
+endforeach
+
efi_conf.set10('ENABLE_TPM', get_option('tpm'))
foreach ctype : ['color-normal', 'color-entry', 'color-highlight', 'color-edit']
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wstringop-truncation\"")
-#define DISABLE_WARNING_ZERO_LENGTH_BOUNDS \
+#if HAVE_WARNING_ZERO_LENGTH_BOUNDS
+# define DISABLE_WARNING_ZERO_LENGTH_BOUNDS \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wzero-length-bounds\"")
+#else
+# define DISABLE_WARNING_ZERO_LENGTH_BOUNDS \
+ _Pragma("GCC diagnostic push")
+#endif
-#define DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT \
+#if HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT
+# define DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
+#else
+# define DISABLE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT \
+ _Pragma("GCC diagnostic push")
+#endif
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")