[cfe-dev] Enabling strong enum extensions under C

Martin J. O'Riordan via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 19 13:17:46 PST 2016


I have the same kind of dilemma - I really like having a "strictly conforming" option because I love Standards, but realistically I need them to be supplemented by a relaxed mode that permits extensions.

What I think would be the right thing for Clang, would be for '-std=XXX' to enforce the ISO definition of XXX, but to be able to supplement it with an additional option or options that enabled the extensions or relaxed the ISO rules (warnings of divergence are still good).  Normally when I use '-std=XXX', I also find I have to use at least ' -U__STRICT_ANSI__' because the extended or non-Standard behaviour is what I often want; and sometimes other additional options.  But having '-std=XXX' mean exactly the ISO definition is really useful, and cool.

Ironically, having '-std=XXX' be really strict about ISO compliance is almost certainly the wrong thing for my code; for example it means enabling exceptions which are simply too expensive for embedded; but I would still like to tell the compiler to enforce strict ISO conformance rules - unless I have supplemented it with options to relax particular constraints.  Sometimes we use '-std=XXX' to select a dialect (e.g. C++11 versus C++14), but then have to supplement it by a bunch of other options that tune it to our actual non-Standard needs.  But I still need warnings and error messages, they tell me where I need to be very specific about what and why I am doing something that strays outside the ISO interpretation.

An alternative would to be to add something like '-fstrict-iso' to make '-std=XXX' be strict, but my own feeling is that strict should be the default, and relaxed should be the deliberately selected alternative.

	MartinO

-----Original Message-----
From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Joerg Sonnenberger via cfe-dev
Sent: 19 February 2016 15:20
To: cfe-dev at lists.llvm.org
Subject: Re: [cfe-dev] Enabling strong enum extensions under C

On Tue, Feb 16, 2016 at 09:46:27AM -0500, Nico Weber via cfe-dev wrote:
> Personally, I'd like if -std=c11 would give you C11 without extensions.

Speaking with OS developer hat, it is not practical to disable all extensions like the protected versions of keywords or attributes.

Joerg
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list