On 09/19/2014 09:29 AM, Marek Polacek wrote:
But we also started to warn on
CPP_KEYWORD and two others: "case value not in enumerated type".
Fixed by moving CPP_KEYWORD, CPP_TEMPLATE_ID, and CPP_NESTED_NAME_SPECIFIER
into enum cpp_ttype. Not sure if this is going to hurt something else.
Wait, -Wswitch warns if any of the case labels don't correspond to
enumerators? Apparently so, it complains about
enum E { a=1,b=2,c=4 } e;
int main()
{
switch (e)
{
case a|b: break;
default: break;
}
}
That seems bogus. The docs say,
"'case' labels outside the enumeration range also provoke warnings when
this option is used (even if there is a 'default' label)."
but 3 is within the range 1-4.
If this is working as intended, I'm still uneasy about moving the C++
internal token types into libcpp; instead, I think I'd prefer to work
around the warning by suppressing -Wswitch inside affected functions or
moving the cases to ifs.
Jason