Alexei Podtelezhnikov wrote:
> -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10)
> +# elif ((__GNUC__ >= 7) \
> +        || (defined __apple_build_version__ \
> +            ? __apple_build_version__ >= 14000000 \
> +            : __clang_major__ >= 10))
> 
> Wiki suggests __apple_build_version__ >= 12000000
> https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2

Interesting. Can you test it (by compiling Werner's test program from
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html>
on an Xcode version between 12.0 and 12.4)?

> Would  it perhaps be better if clang used [[fallthrough]]  instead of
> __attribute__((fallthrough))? They have supported [[fallthrough]]
> since at least 3.5.0 circa 2014.

They have supported it only in C++ mode. Not in C mode. E.g. with clang 4.0.0:

$ clang -S foo.c
foo.c:9:9: error: expected expression
        [[fallthrough]];
        ^
foo.c:12:9: error: expected expression
        [[fallthrough]];
        ^
2 errors generated.

> There was also a suggestion on this list to use __has_attribute.
> https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00267.html

We do so in gnulib-common.m4, and the resulting code is more convoluted
than the code we have now.

Also, we're not using '#include "attribute.h"' in dfa.c because gawk uses
dfa.c and does not like to import so many Gnulib definitions.

Bruno




Reply via email to