From 25757f83c5914062d775b0237218b912be4f8a5a Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 4 Nov 2024 10:19:43 -0800 Subject: [PATCH] autoconf: update some of the m4 library Update some files in the m4 library. This also updates config/unconfig.h to match. 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 ++++- config/unconfig.h | 16 ++++++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/autoconf/m4/pa_add_flags.m4 b/autoconf/m4/pa_add_flags.m4 index 23f96f12..c7fb7656 100644 --- a/autoconf/m4/pa_add_flags.m4 +++ b/autoconf/m4/pa_add_flags.m4 @@ -1,9 +1,10 @@ dnl -------------------------------------------------------------------------- -dnl PA_ADD_FLAGS(flagvar, flags) +dnl PA_ADD_FLAGS(flagvar, flags [, real-flags [, success [, failure]]]) dnl -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 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 -------------------------------------------------------------------------- AC_DEFUN([PA_ADD_FLAGS], [ diff --git a/autoconf/m4/pa_common_attributes.m4 b/autoconf/m4/pa_common_attributes.m4 index 8b8dc9e3..0594f3e1 100644 --- a/autoconf/m4/pa_common_attributes.m4 +++ b/autoconf/m4/pa_common_attributes.m4 @@ -15,5 +15,6 @@ 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 ae7d9db8..0c9dd372 100644 --- a/autoconf/m4/pa_option_debug.m4 +++ b/autoconf/m4/pa_option_debug.m4 @@ -9,5 +9,7 @@ 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 39a3f6cf..fb409e42 100644 --- a/autoconf/m4/pa_option_profiling.m4 +++ b/autoconf/m4/pa_option_profiling.m4 @@ -5,4 +5,7 @@ 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])])]) +[PA_ADD_LANGFLAGS([-pg]) + AC_DEFINE([WITH_PROFILING], 1, + [Define to 1 to include code specifically indended to help profiling.]) +])]) diff --git a/config/unconfig.h b/config/unconfig.h index 3afcb206..3713ecfa 100644 --- a/config/unconfig.h +++ b/config/unconfig.h @@ -107,6 +107,22 @@ # 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)