autoconf-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug testing for fallthrough attribute in ax_gcc_func_attribute.m4


From: Cheyenne Wills
Subject: bug testing for fallthrough attribute in ax_gcc_func_attribute.m4
Date: Fri, 15 May 2020 17:06:23 -0600

Hello, 

Hopefully this is the right email to report a bug.

When testing for the fallthrough attribute with clang-10, the test is failing with a false negative (e.g. it's failing for a different reason).

Here is the output of a config.log with the warnings that are being generated by clang-10

configure:31082: checking for __attribute__((fallthrough))
configure:31103: clang-10 -o conftest     conftest.c  >&5
conftest.c:232:46: warning: no case matching constant switch condition '0'
                    int foo( void ) {switch (0) { case 1: __attribute__((fallthrough)); case 2: break ; }};
                                             ^
conftest.c:232:106: warning: non-void function does not return a value [-Wreturn-type]
                    int foo( void ) {switch (0) { case 1: __attribute__((fallthrough)); case 2: break ; }};
                                                                                                         ^
2 warnings generated.
configure:31103: $? = 0
configure:31116: result: no


Looking at the ax_gcc_func_attribute.m4 file, the C code for the test is:

    int foo( void ) {switch (0) { case 1: __attribute__((fallthrough)); case 2: break ; }};

I tested the following and this looks like it might be a possible fix:

    void foo(int x) { switch(x) { case 1:__attribute__((fallthrough)); case 2: break ; }};


Cheyenne Wills
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]