Clang also understands '#pragma GCC diagnostic ignored "-Wformat-nonliteral"', and refuses to build format.c with -Werror without it.
* src/m4.h: Prefer _GL_GNUC_PREREQ over bare __GNUC__ probes. * src/format.c (expand_format): Likewise, and widen scope to also appease clang. Reported by David Arnstein in: https://lists.gnu.org/archive/html/bug-m4/2024-12/msg00002.html --- src/format.c | 4 ++-- src/m4.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/format.c b/src/format.c index 74e5d614..eeacce1d 100644 --- a/src/format.c +++ b/src/format.c @@ -349,7 +349,7 @@ expand_format (struct obstack *obs, int argc, token_data **argv) *p = '\0'; /* Our constructed format string in fstart is safe. */ -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +#if _GL_GNUC_PREREQ (4, 3) || defined __clang__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif @@ -379,7 +379,7 @@ expand_format (struct obstack *obs, int argc, token_data **argv) default: abort(); } -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +#if _GL_GNUC_PREREQ (4, 3) # pragma GCC diagnostic pop #endif diff --git a/src/m4.h b/src/m4.h index 5a705f08..a20bd8bc 100644 --- a/src/m4.h +++ b/src/m4.h @@ -114,7 +114,7 @@ typedef void builtin_func (struct obstack *, int, token_data **); /* Gnulib's stdbool doesn't work with bool bitfields. For nicer debugging, use bool when we know it works, but use the more portable unsigned int elsewhere. */ -#if __GNUC__ > 2 +#if _GL_GNUC_PREREQ (2, 0) typedef bool bool_bitfield; #else typedef unsigned int bool_bitfield; base-commit: cc48aad541d66fa0d6ed11eec7ec0574353c9d37 prerequisite-patch-id: c400153f433d874e6bbf77dcf3755719cf7633b9 prerequisite-patch-id: 1c9109c5f2760b84b17e2fd55c2c77b60ce5e18d prerequisite-patch-id: 1cd4973a867f514b517cce3e3fa25fb6dc051c9c prerequisite-patch-id: e3bfcdfad4e654813c68055110ab05ead4cce7e9 prerequisite-patch-id: eb0029567e704bf366b05aabec2abfa2a2e76273 -- 2.49.0 _______________________________________________ M4-patches mailing list [email protected] https://lists.gnu.org/mailman/listinfo/m4-patches
