buildsys: update ax_gcc_func_attribute to fix fallthrough detection

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Yury V. Zaytsev 2024-05-30 19:26:07 +02:00 committed by Andrew Borodin
parent 40867e5740
commit 87bdeeb591

View File

@ -42,6 +42,7 @@
# flatten
# format
# format_arg
# gnu_format
# gnu_inline
# hot
# ifunc
@ -77,7 +78,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 9
#serial 13
AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
@ -132,7 +133,7 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
int foo( void ) __attribute__(($1));
],
[fallthrough], [
int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }};
void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }};
],
[flatten], [
int foo( void ) __attribute__(($1));
@ -140,6 +141,9 @@ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
[format], [
int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
],
[gnu_format], [
int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2)));
],
[format_arg], [
char *foo(const char *p) __attribute__(($1(1)));
],
@ -224,7 +228,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])])