Re: Apple LLVM 10 and `__fallthrough__`

2023-02-27 Thread Bruno Haible
Alexei Podtelezhnikov wrote: > > > Wiki suggests __apple_build_version__ >= 1200 > > > https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2 > ... > I wish I could directly test it. However, I could confirm that Swift > release 5.3 (Xcode 12) was the first release wi

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-27 Thread Alexei Podtelezhnikov
> > > -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) > > > +# elif ((__GNUC__ >= 7) \ > > > +|| (defined __apple_build_version__ \ > > > +? __apple_build_version__ >= 1400 \ > > > +: __clang_major__ >= 10)) > > > > > > Wiki suggests __apple_build_version__ >=

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Jeffrey Walton
On Sun, Feb 26, 2023 at 10:08 PM Alexei Podtelezhnikov wrote: > > On Sun, Feb 26, 2023 at 7:08 PM Bruno Haible wrote: > > > > Alexei Podtelezhnikov wrote: > > > -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) > > > +# elif ((__GNUC__ >= 7) \ > > > +|| (defined __apple_build_version__ \

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Alexei Podtelezhnikov
On Sun, Feb 26, 2023 at 7:08 PM Bruno Haible wrote: > > Alexei Podtelezhnikov wrote: > > -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) > > +# elif ((__GNUC__ >= 7) \ > > +|| (defined __apple_build_version__ \ > > +? __apple_build_version__ >= 1400 \ > > +:

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Jeffrey Walton
On Sun, Feb 26, 2023 at 6:36 PM Alexei Podtelezhnikov wrote: > [...] > 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. In this particular case they are > ahead of GCC and to

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Bruno Haible
Alexei Podtelezhnikov wrote: > -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) > +# elif ((__GNUC__ >= 7) \ > +|| (defined __apple_build_version__ \ > +? __apple_build_version__ >= 1400 \ > +: __clang_major__ >= 10)) > > Wiki suggests __apple_build_version__

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Alexei Podtelezhnikov
-# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) +# elif ((__GNUC__ >= 7) \ +|| (defined __apple_build_version__ \ +? __apple_build_version__ >= 1400 \ +: __clang_major__ >= 10)) Wiki suggests __apple_build_version__ >= 1200 https://en.wikipedia.org/wiki/X

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Werner LEMBERG
> I haven't been able to find out precisely which versions produce the > warning, by looking at https://github.com/apple/llvm-project . So, > I'm applying the conservative patch: [...] Thanks! Maybe other Apple users chime in so that the test can be refined if necessary. Werner

Re: Apple LLVM 10 and `__fallthrough__`

2023-02-26 Thread Bruno Haible
Hi Werner, > In `lib/dfa.c` I see > > ``` > ... > # elif (__GNUC__ >= 7) || (__clang_major__ >= 10) > # define FALLTHROUGH __attribute__ ((__fallthrough__)) > ... > ``` > > I now wonder whether it would be better to have a special case for > Apple LLVM to avoid this warning. Indeed, it's not t

Apple LLVM 10 and `__fallthrough__`

2023-02-22 Thread Werner LEMBERG
This snippet ``` #include int main(int argc, char* argv[]) { switch(argc) { case 3: puts(argv[2]); __attribute__((fallthrough)); case 2: puts(argv[1]); __attribute__((__fallthrough__)); case 1: puts(argv[0]); /* fall through */