diff options
author | Ian Lance Taylor <iant@google.com> | 2009-06-08 04:00:50 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2009-06-08 04:00:50 +0000 |
commit | cdb884681d2b2f835e4457d84648b82d55e71262 (patch) | |
tree | 4bd535229794d01698a0f16070f3eb455edc1fcf /gcc/c-common.c | |
parent | 36b31e072b92b7ba2c91b01a49b370abe6b12498 (diff) | |
download | gcc-cdb884681d2b2f835e4457d84648b82d55e71262.zip gcc-cdb884681d2b2f835e4457d84648b82d55e71262.tar.gz gcc-cdb884681d2b2f835e4457d84648b82d55e71262.tar.bz2 |
dwarf2.h (enum dwarf_location_atom): Add INTERNAL_DW_OP_tls_addr.
./: * dwarf2.h (enum dwarf_location_atom): Add
INTERNAL_DW_OP_tls_addr.
* dwarf2out.c (INTERNAL_DW_OP_tls_addr): Don't #define.
* c-common.c (c_do_switch_warnings): Don't exit early for -Wswitch
with no default node. Change warning with %H to warning_at.
Don't clear warn_switch around case checking.
* doc/invoke.texi (Warning Options): Clarify distinction between
-Wswitch and -Wswitch-enum.
java/:
* jcf-parse.c (handle_constant): Change local variable 'kind' to
unsigned int.
testsuite/:
* g++.dg/warn/Wswitch-3.C: New testcase.
* gcc.dg/Wswitch.c: Adjust for -Wswitch change.
* gcc.dg/Wswitch-enum-error.c: Likewise.
* gcc.dg/Wswitch-error.c: Likewise.
From-SVN: r148270
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 45b4192..b26662d 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5425,7 +5425,6 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location, splay_tree_node default_node; splay_tree_node node; tree chain; - int saved_warn_switch; if (!warn_switch && !warn_switch_enum && !warn_switch_default) return; @@ -5439,15 +5438,15 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location, if (!type || TREE_CODE (type) != ENUMERAL_TYPE) return; - /* If the switch expression was an enumerated type, check that - exactly all enumeration literals are covered by the cases. - The check is made when -Wswitch was specified and there is no - default case, or when -Wswitch-enum was specified. */ - - if (!warn_switch_enum - && !(warn_switch && !default_node)) + /* From here on, we only care about -Wswitch and -Wswitch-enum. */ + if (!warn_switch_enum && !warn_switch) return; + /* Check the cases. Warn about case values which are not members of + the enumerated type. For -Wswitch-enum, or for -Wswitch when + there is no default case, check that exactly all enumeration + literals are covered by the cases. */ + /* Clearing COND if it is not an integer constant simplifies the tests inside the loop below. */ if (TREE_CODE (cond) != INTEGER_CST) @@ -5498,13 +5497,15 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location, continue; /* If there is a default_node, the only relevant option is - Wswitch-enum. Otherwise, if both are enabled then we prefer + Wswitch-enum. Otherwise, if both are enabled then we prefer to warn using -Wswitch because -Wswitch is enabled by -Wall while -Wswitch-enum is explicit. */ - warning ((default_node || !warn_switch) - ? OPT_Wswitch_enum : OPT_Wswitch, - "%Henumeration value %qE not handled in switch", - &switch_location, TREE_PURPOSE (chain)); + warning_at (switch_location, + (default_node || !warn_switch + ? OPT_Wswitch_enum + : OPT_Wswitch), + "enumeration value %qE not handled in switch", + TREE_PURPOSE (chain)); } /* Warn if there are case expressions that don't correspond to @@ -5516,16 +5517,7 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location, every disjoint case label, with CASE_LOW_SEEN and CASE_HIGH_SEEN above. This scan also resets those fields. */ - /* If there is a default_node, the only relevant option is - Wswitch-enum. Otherwise, if both are enabled then we prefer - to warn using -Wswitch because -Wswitch is enabled by -Wall - while -Wswitch-enum is explicit. */ - saved_warn_switch = warn_switch; - if (default_node) - warn_switch = 0; splay_tree_foreach (cases, match_case_to_enum, type); - warn_switch = saved_warn_switch; - } /* Finish an expression taking the address of LABEL (an |