From 66b9e4216f3353fcc2ec649ce46e70c48f5c4680 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Tue, 20 Sep 2022 14:04:51 -0300 Subject: [PATCH 1/2] Fix detection of unknown gcc function attributes This reverts commit 0a47fdf53890e835b9b60ea15446347900c2d16c, which originally reverted this patch due to MacOS build failures. --- build/ax_gcc_func_attribute.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ax_gcc_func_attribute.m4 b/build/ax_gcc_func_attribute.m4 index 79478f56b8bfd..355ea92805019 100644 --- a/build/ax_gcc_func_attribute.m4 +++ b/build/ax_gcc_func_attribute.m4 @@ -227,7 +227,7 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ dnl GCC doesn't exit with an error if an unknown attribute is dnl provided but only outputs a warning, so accept the attribute dnl only if no warning were issued. - [AS_IF([test -s conftest.err], + [AS_IF([grep -- -Wattributes conftest.err], [AS_VAR_SET([ac_var], [no])], [AS_VAR_SET([ac_var], [yes])])], [AS_VAR_SET([ac_var], [no])]) From 2555ec47e1c5dabe20a82ff6533b990d4e4b3728 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Thu, 22 Sep 2022 11:49:46 -0300 Subject: [PATCH 2/2] Support Clang in ax_gcc_func_attribute.m4 As described in commit 813d942, the embedded GCC macro in `build/ax_gcc_func_attribute.m4` throws false negatives anytime unrelated warnings are raised, setting `have_func_attribute` to no. The fix proposed in the macro upstream changed detecting any warnings to detecting issues related to `-Wattributes` only in order to decide when to set `HAVE_FUNC_ATTRIBUTE_*`. However, the Clang front-end equivalent is `-Wunknown-attribute`. This patch extends ax_gcc_func_attribute.m4 checks to also match the Clang warning. --- build/ax_gcc_func_attribute.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ax_gcc_func_attribute.m4 b/build/ax_gcc_func_attribute.m4 index 355ea92805019..4ab2a4a23cb8d 100644 --- a/build/ax_gcc_func_attribute.m4 +++ b/build/ax_gcc_func_attribute.m4 @@ -227,7 +227,7 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ dnl GCC doesn't exit with an error if an unknown attribute is dnl provided but only outputs a warning, so accept the attribute dnl only if no warning were issued. - [AS_IF([grep -- -Wattributes conftest.err], + [AS_IF([grep -- '-W\(unknown-\)\?attributes' conftest.err], [AS_VAR_SET([ac_var], [no])], [AS_VAR_SET([ac_var], [yes])])], [AS_VAR_SET([ac_var], [no])])