ax_gcc_func_attribute: Revise the detection of unknown attributes
authorMing Chen <ming.chen1986@gmail.com>
Mon, 2 Mar 2020 01:40:36 +0000 (09:40 +0800)
committerOndřej Surý <ondrej@debian.org>
Mon, 24 Jun 2024 11:16:58 +0000 (13:16 +0200)
GCC outputs a warning when Wstrict-prototypes is on, in such case the
attribute detection always fails even if the attribute is actually
supported. This change checks for the "-Wattributes" warning in
conftest.err instead of the existence of the file.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/php8.1/+bug/1882279
Forwarded: https://github.com/php/php-src/pull/8483
Origin: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commitdiff;h=df0894ad1a8195df67a52108b931e07d708cec9a
Last-Update: 2022-05-02

Gbp-Pq: Name 0044-Update-gcc-func-attr-macro.patch

build/ax_gcc_func_attribute.m4

index 79f3eef82bc067ec173467c7fc5f988619349664..46330932f1a8a5dcb5edddc1b211de57e05729c2 100644 (file)
@@ -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])])