This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wswitch-fallthrough
- From: NightStrike <nightstrike at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 11 Jul 2016 16:28:32 -0400
- Subject: Re: Implement -Wswitch-fallthrough
- Authentication-results: sourceware.org; auth=none
- References: <20160711194340.GI13963@redhat.com>
On Mon, Jul 11, 2016 at 3:43 PM, Marek Polacek <polacek@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)) ?