On Mon, Jul 11, 2016 at 04:28:32PM -0400, NightStrike wrote: > On Mon, Jul 11, 2016 at 3:43 PM, Marek Polacek <pola...@redhat.com> wrote: > > But then the [[fallthrough]] attribute was > > approved for C++17 [1], and that's what has got me to do all this. > > ... > > I added a new builtin, > > __builtin_fallthrough, that prevents the warning from occurring. It can > > only > > be used in a switch; the compiler will issue an error otherwise. The new > > C++ > > attribute can then be implemented in terms of this builtin. > > This is a stupid question I'm sure, but if C++ can have the attribute > version, why can't C have __attribute__((fallthrough)) ?
We could, but why? I already added __builtin_fallthrough() and __attribute__((fallthrough)) would just be turned into that. C++17 adds the fallthrough attribute for a null statement, so we need to implement that, but again I expect that I just turn that to __builtin_fallthrough(). We plan to add __Fallthrough to C, but that is a long way off. Does "__attribute__((fallthrough));" have any advantages over "__builtin_fallthrough()"? Marek