[cfe-commits] [PATCH] Implicit fall-through between switch labels

Jordy Rose jediknil at belkadan.com
Sat Apr 21 19:48:12 PDT 2012


On Apr 21, 2012, at 20:40, Chandler Carruth wrote:

> On Sat, Apr 21, 2012 at 5:10 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>> On Sat, Apr 21, 2012 at 4:54 PM, Joe Groff <arcata at gmail.com> wrote:
>>> For future-proofing's sake, does the standard provide any guidance for
>>> naming nonstandardized attributes? Should the attribute be named
>>> something like 'clang::fallthrough' instead of just 'fallthrough', in
>>> case a future standard or other implementations provide for a similar
>>> attribute with different behavior?
>>> 
>> Yes, I think so. The attribute namespace mechanism was designed to allow such vendor extensions without creating problems for future standardization. 
>> 
> I would find this extremely unfortunate. The fallthrough check doesn't seem likely at all to be a vendor-specific extension. I can't imagine any possible standardized meaning for the attribute other than the use being proposed here. Forcing users to type 'clang::' in each place seems to reduce the clarity and readability of the construct with no real benefit. Is this really necessary? Can we not add a top-level attribute when it makes sense?

I'm with Chandler. The namespacing syntax would be useful for something like analyzer_noreturn, but this is something other compiler vendors could implement as well. I know we're supposed to be careful about adding language extensions (should this discussion be on cfe-dev?) but this is hardly a vendor-specific warning.

Jordy






More information about the cfe-commits mailing list