From 2dbabcbf550e28309b597d96e72b18fe89a94fde Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 4 Dec 2021 13:16:12 +0100 Subject: [PATCH 1/2] m4/ax_c_pragmas.m4: add HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_PEDANTIC Signed-off-by: Jim Klimov --- m4/ax_c_pragmas.m4 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/m4/ax_c_pragmas.m4 b/m4/ax_c_pragmas.m4 index d274b129bc..b81426540f 100644 --- a/m4/ax_c_pragmas.m4 +++ b/m4/ax_c_pragmas.m4 @@ -146,6 +146,33 @@ dnl ### [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-warning" ]) dnl Special pragma support testing for clang dnl Test common pragmas for GCC (and compatible) compilers + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wpedantic"], + [ax_cv__pragma__gcc__diags_ignored_pedantic], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[void func(void) { +#pragma GCC diagnostic ignored "-Wpedantic" +} +]], [])], + [ax_cv__pragma__gcc__diags_ignored_pedantic=yes], + [ax_cv__pragma__gcc__diags_ignored_pedantic=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_pedantic" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_PEDANTIC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wpedantic"]) + ]) + + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wpedantic" (outside functions)], + [ax_cv__pragma__gcc__diags_ignored_pedantic_besidefunc], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wpedantic"]], [])], + [ax_cv__pragma__gcc__diags_ignored_pedantic_besidefunc=yes], + [ax_cv__pragma__gcc__diags_ignored_pedantic_besidefunc=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_pedantic_besidefunc" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_PEDANTIC_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wpedantic" (outside functions)]) + ]) + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunused-function"], [ax_cv__pragma__gcc__diags_ignored_unused_function], [AC_COMPILE_IFELSE( From 31bcd00c4624824ea40bb6f7307a89733cc66f08 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 29 Feb 2024 21:54:01 +0000 Subject: [PATCH 2/2] m4/ax_c_pragmas.m4: introduce HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ADDRESS Signed-off-by: Jim Klimov --- m4/ax_c_pragmas.m4 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/m4/ax_c_pragmas.m4 b/m4/ax_c_pragmas.m4 index b81426540f..5d175082bf 100644 --- a/m4/ax_c_pragmas.m4 +++ b/m4/ax_c_pragmas.m4 @@ -689,6 +689,33 @@ dnl ### [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-warning" AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wextra-semi-stmt" (outside functions)]) ]) + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Waddress"], + [ax_cv__pragma__gcc__diags_ignored_address], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[void func(void) { +#pragma GCC diagnostic ignored "-Waddress" +} +]], [])], + [ax_cv__pragma__gcc__diags_ignored_address=yes], + [ax_cv__pragma__gcc__diags_ignored_address=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_address" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ADDRESS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Waddress"]) + ]) + + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Waddress" (outside functions)], + [ax_cv__pragma__gcc__diags_ignored_address_besidefunc], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Waddress"]], [])], + [ax_cv__pragma__gcc__diags_ignored_address_besidefunc=yes], + [ax_cv__pragma__gcc__diags_ignored_address_besidefunc=no] + )] + ) + AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_address_besidefunc" = "yes"],[ + AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ADDRESS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Waddress" (outside functions)]) + ]) + AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-align"], [ax_cv__pragma__gcc__diags_ignored_cast_align], [AC_COMPILE_IFELSE(