Ticket #4524: 0001-buildsys-update-ax_gcc_func_attribute-to-fix-fallthr.patch

File 0001-buildsys-update-ax_gcc_func_attribute-to-fix-fallthr.patch, 2.4 KB (added by zaytsev, 5 months ago)
  • m4.include/ax_gcc_func_attribute.m4

    From d5871ffb64d0c7bee96ad9d5c5462df5e7c48fee Mon Sep 17 00:00:00 2001
    From: "Yury V. Zaytsev" <yury@shurup.com>
    Date: Thu, 30 May 2024 19:26:07 +0200
    Subject: [PATCH] buildsys: update ax_gcc_func_attribute to fix fallthrough
     detection
    
    Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
    ---
     m4.include/ax_gcc_func_attribute.m4 | 10 +++++++---
     1 file changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/m4.include/ax_gcc_func_attribute.m4 b/m4.include/ax_gcc_func_attribute.m4
    index 098c9aadf..fa4e089d6 100644
    a b  
    4242#    flatten 
    4343#    format 
    4444#    format_arg 
     45#    gnu_format 
    4546#    gnu_inline 
    4647#    hot 
    4748#    ifunc 
     
    7778#   and this notice are preserved.  This file is offered as-is, without any 
    7879#   warranty. 
    7980 
    80 #serial 9 
     81#serial 13 
    8182 
    8283AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ 
    8384    AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) 
    AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ 
    132133                    int foo( void ) __attribute__(($1)); 
    133134                ], 
    134135                [fallthrough], [ 
    135                     int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }}; 
     136                    void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }}; 
    136137                ], 
    137138                [flatten], [ 
    138139                    int foo( void ) __attribute__(($1)); 
    AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ 
    140141                [format], [ 
    141142                    int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); 
    142143                ], 
     144                [gnu_format], [ 
     145                    int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2))); 
     146                ], 
    143147                [format_arg], [ 
    144148                    char *foo(const char *p) __attribute__(($1(1))); 
    145149                ], 
    AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ 
    224228            dnl GCC doesn't exit with an error if an unknown attribute is 
    225229            dnl provided but only outputs a warning, so accept the attribute 
    226230            dnl only if no warning were issued. 
    227             [AS_IF([test -s conftest.err], 
     231            [AS_IF([grep -- -Wattributes conftest.err], 
    228232                [AS_VAR_SET([ac_var], [no])], 
    229233                [AS_VAR_SET([ac_var], [yes])])], 
    230234            [AS_VAR_SET([ac_var], [no])])