diff options
author | Richard Stallman <rms@gnu.org> | 1992-06-23 02:19:48 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-06-23 02:19:48 +0000 |
commit | 1ddde1cde5a6be92c007fe24fe598215dce7cfd7 (patch) | |
tree | aa716efa2c1d317569da3e256c610ea26776de01 /gcc | |
parent | d24eed4d260d46db4af48acf4b5f540adfada316 (diff) | |
download | gcc-1ddde1cde5a6be92c007fe24fe598215dce7cfd7.zip gcc-1ddde1cde5a6be92c007fe24fe598215dce7cfd7.tar.gz gcc-1ddde1cde5a6be92c007fe24fe598215dce7cfd7.tar.bz2 |
*** empty log message ***
From-SVN: r1239
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/stmt.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -3444,10 +3444,10 @@ check_for_full_enumeration_handling (type) n = n->right) ; - if (!(n && tree_int_cst_equal (n->low, TREE_VALUE (chain)))) + if (!n || tree_int_cst_lt (TREE_VALUE (chain), n->low)) { if (warn_switch) - warning ("enumerated value `%s' not handled in switch", + warning ("enumeration value `%s' not handled in switch", IDENTIFIER_POINTER (TREE_PURPOSE (chain))); all_values = 0; } @@ -3473,6 +3473,21 @@ check_for_full_enumeration_handling (type) == IDENTIFIER_NODE) ? TYPE_NAME (type) : DECL_NAME (TYPE_NAME (type)))); + if (!tree_int_cst_equal (n->low, n->high)) + { + for (chain = TYPE_VALUES (type); + chain && !tree_int_cst_equal (n->high, TREE_VALUE (chain)); + chain = TREE_CHAIN (chain)) + ; + + if (!chain) + warning ("case value `%d' not in enumerated type `%s'", + TREE_INT_CST_LOW (n->high), + IDENTIFIER_POINTER ((TREE_CODE (TYPE_NAME (type)) + == IDENTIFIER_NODE) + ? TYPE_NAME (type) + : DECL_NAME (TYPE_NAME (type)))); + } } /* If all values were found as case labels, make one of them the default |