diff options
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r-- | gcc/c-parse.in | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index fbfa994..b3b4dc2 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -2101,8 +2101,14 @@ label: CASE expr_no_commas ':' if (value != error_mark_node) { tree duplicate; - int success = pushcase (value, convert_and_check, - label, &duplicate); + int success; + + if (pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value))) + pedwarn ("label must have integral type in ANSI C"); + + success = pushcase (value, convert_and_check, + label, &duplicate); + if (success == 1) error ("case label not within a switch statement"); else if (success == 2) |