c-warn.c (match_case_to_enum_1): Don't warn about enums with no enumerators.
* c-warn.c (match_case_to_enum_1): Don't warn about enums with no enumerators. From-SVN: r248303
This commit is contained in:
parent
2944f36d02
commit
1ff7be5ac8
3 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2017-05-19 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* c-warn.c (match_case_to_enum_1): Don't warn about enums with no
|
||||
enumerators.
|
||||
|
||||
2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
||||
|
||||
* c-format.c (locus): Move out of function scope,
|
||||
|
|
|
@ -1069,6 +1069,10 @@ warnings_for_convert_and_check (location_t loc, tree type, tree expr,
|
|||
static void
|
||||
match_case_to_enum_1 (tree key, tree type, tree label)
|
||||
{
|
||||
/* Avoid warning about enums that have no enumerators. */
|
||||
if (TYPE_VALUES (type) == NULL_TREE)
|
||||
return;
|
||||
|
||||
char buf[WIDE_INT_PRINT_BUFFER_SIZE];
|
||||
|
||||
if (tree_fits_uhwi_p (key))
|
||||
|
|
13
gcc/testsuite/g++.dg/cpp1z/byte2.C
Normal file
13
gcc/testsuite/g++.dg/cpp1z/byte2.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
// { dg-options "-std=c++17 -Wall" }
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
bool white_space(std::byte x) {
|
||||
switch (x) {
|
||||
case std::byte{' '}: case std::byte{'\t'}: case std::byte{'\v'}:
|
||||
case std::byte{'\f'}: case std::byte{'\n'}:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue