[cfe-dev] Explicit warning diagnostic flags for groups
Peter N Lewis
peter at stairways.com.au
Tue Aug 13 07:03:49 PDT 2013
On 13/08/2013, at 16:42 , Dmitri Gribenko <gribozavr at gmail.com> wrote:
> This change looks correct. There are two points to consider:
> * choice of the option name. Does GCC have a similar option? Does
> GCC have a name for this extension in the documentation?
Very good question, to which I don't have a very good answer. There does not appear to be a matching GCC option.
GCC describes the issues as either "5.7 Conditionals with Omitted Operands", and mentions it as "the middle operand in a conditional expression may be omitted" or "omitting the middle term of a "?:" expression". The operator is either a "conditional expression" or a "ternary operator". And finally clang's warning is "use of GNU ?: expression extension, eliding middle term", making no mention of conditional, ternary or omitting.
So far I chose ternary-eliding-expression and gnu-ternary-eliding-expression, matching the behaviour of static-float-init and gnu-static-float-init, since despite it being originally a GNU extension, now it's a clang extension.
"conditional" is too vague. ternary-omitted-operand would be fine, but then I would change the warning in clang to "use of GNU ?: expression extension, omitting middle term" to match, and I wasn't sure I wanted to do that. I kind of prefer this one, but it's a slightly larger change, and I don't know the consequences of changing a warning message might have, though I suppose the warning will change slightly anyway with the introduction of the specific flag. I'm not sure what clang documentation might refer to this feature - is that something to worry about as well?
> * this change needs tests. You can model tests for this option based on this example:
>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-static-const-float.cpp?revision=173841&view=markup
>
> The new test file should go into the same directory as the example.
Yep, coincidently, that is *exactly* the test I based it on, although I decided it needed to be in the Sema directory instead because it's not a C++ issue.
Thanks,
Peter.
--
Keyboard Maestro 6.1 now out - set web checkboxes & radio buttons, exit from loops, and more.
Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/> <http://download.keyboardmaestro.com/>
More information about the cfe-dev
mailing list