From 33eda4304209d56fc8c723807aff1a09221f16d2 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 11 Aug 2025 18:54:17 -0700 Subject: [PATCH] autoconf: update m4 macros and config/unconfig.h (Does unconfig.h really need to be in the git tree?) Signed-off-by: H. Peter Anvin --- autoconf/m4/pa_add_flags.m4 | 9 ++++----- autoconf/m4/pa_common_attributes.m4 | 1 - autoconf/m4/pa_option_debug.m4 | 2 -- autoconf/m4/pa_option_profiling.m4 | 5 +---- autoconf/m4/pa_variadic_macros.m4 | 24 ++++++++++++++++++++---- config/unconfig.h | 16 ---------------- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/autoconf/m4/pa_add_flags.m4 b/autoconf/m4/pa_add_flags.m4 index c7fb7656..23f96f12 100644 --- a/autoconf/m4/pa_add_flags.m4 +++ b/autoconf/m4/pa_add_flags.m4 @@ -1,10 +1,9 @@ dnl -------------------------------------------------------------------------- -dnl PA_ADD_FLAGS(flagvar, flags [, real-flags [, success [, failure]]]) +dnl PA_ADD_FLAGS(flagvar, flags) dnl -dnl Add [real-flags] (default [flags]) to the variable [flagvar] if -dnl and only if [flags] are accepted by all languages affected by -dnl [flagvar], if those languages have been previously seen in the -dnl script. +dnl Add [flags] to the variable [flagvar] if and only if it is accepted +dnl by all languages affected by [flagvar], if those languages have +dnl been previously seen in the script. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_ADD_FLAGS], [ diff --git a/autoconf/m4/pa_common_attributes.m4 b/autoconf/m4/pa_common_attributes.m4 index 0594f3e1..8b8dc9e3 100644 --- a/autoconf/m4/pa_common_attributes.m4 +++ b/autoconf/m4/pa_common_attributes.m4 @@ -15,6 +15,5 @@ AC_DEFUN([PA_COMMON_ATTRIBUTES], PA_FUNC_ATTRIBUTE(const) PA_FUNC_ATTRIBUTE(pure) PA_FUNC_ATTRIBUTE(cold,,,,,unlikely_func) - PA_FUNC_ATTRIBUTE(used) PA_FUNC_ATTRIBUTE(unused) PA_FUNC_ATTRIBUTE_ERROR]) diff --git a/autoconf/m4/pa_option_debug.m4 b/autoconf/m4/pa_option_debug.m4 index 0c9dd372..ae7d9db8 100644 --- a/autoconf/m4/pa_option_debug.m4 +++ b/autoconf/m4/pa_option_debug.m4 @@ -9,7 +9,5 @@ AC_DEFUN([PA_OPTION_DEBUG], [PA_ADD_LANGFLAGS([-g3])], [PA_ADD_LANGFLAGS([-ggdb3 -g3])]) PA_ARG_ENABLED([debug], [optimize for debugging], [PA_ADD_LANGFLAGS([-Og -O0]) - AC_DEFINE([WITH_DEBUG], 1, - [Define to 1 to include code specifically indended to help debugging.]) $1], [$2])]) diff --git a/autoconf/m4/pa_option_profiling.m4 b/autoconf/m4/pa_option_profiling.m4 index fb409e42..39a3f6cf 100644 --- a/autoconf/m4/pa_option_profiling.m4 +++ b/autoconf/m4/pa_option_profiling.m4 @@ -5,7 +5,4 @@ dnl Try to enable profiling if --enable-profiling is set. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_OPTION_PROFILING], [PA_ARG_ENABLED([profiling], [compile with profiling (-pg option)], -[PA_ADD_LANGFLAGS([-pg]) - AC_DEFINE([WITH_PROFILING], 1, - [Define to 1 to include code specifically indended to help profiling.]) -])]) +[PA_ADD_LANGFLAGS([-pg])])]) diff --git a/autoconf/m4/pa_variadic_macros.m4 b/autoconf/m4/pa_variadic_macros.m4 index a2372ce2..3c7b1c09 100644 --- a/autoconf/m4/pa_variadic_macros.m4 +++ b/autoconf/m4/pa_variadic_macros.m4 @@ -14,7 +14,23 @@ int main(void) return 0; } ])],[pa_cv_variadic_macros=yes],[pa_cv_variadic_macros=no])]) - AS_IF([test "x$pa_cv_variadic_macros" = xyes], - [AC_DEFINE([HAVE_VARIADIC_MACROS], 1, -[define to 1 if your compiler supports C99 __VA_ARGS__ variadic macros.])]) -]) +AS_IF([test "x$pa_cv_variadic_macros" = xyes], + [AC_DEFINE([HAVE_VARIADIC_MACROS], 1, + [define to 1 if your compiler supports C99 __VA_ARGS__ variadic macros.]) + AC_CACHE_CHECK([if $CC supports varadic macro comma dropping], + [pa_cv_varadic_macros_comma_hack], + [AC_LINK_IFELSE([AC_LANG_SOURCE([ +AC_INCLUDES_DEFAULT +#define myprintf(f, ...) printf(f, ## __VA_ARGS__) +int main(void) +{ + myprintf("hello"); + return 0; +} +])])], +[pa_cv_varadic_macros_comma_hack=yes], +[pa_cv_varadic_macros_comma_hack=no]) +AS_IF([test "x$pa_cv_varadic_macros_comma_hack" = xyes], +[AC_DEFINE([HAVE_VARADIC_MACROS_COMMA_HACK], 1, + [define to 1 if your compiler supports the , ## __VA_ARGS__ hack.])]) +])]) diff --git a/config/unconfig.h b/config/unconfig.h index 3713ecfa..3afcb206 100644 --- a/config/unconfig.h +++ b/config/unconfig.h @@ -107,22 +107,6 @@ # endif #endif -#ifndef used_func -# ifdef HAVE_FUNC_ATTRIBUTE_USED -# define used_func ATTRIBUTE(used) -# else -# define used_func -# endif -#endif - -#ifndef used_func_ptr -# ifdef HAVE_FUNC_PTR_ATTRIBUTE_USED -# define used_func_ptr ATTRIBUTE(used) -# else -# define used_func_ptr -# endif -#endif - #ifndef unused_func # ifdef HAVE_FUNC_ATTRIBUTE_UNUSED # define unused_func ATTRIBUTE(unused)