aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-02-04 23:05:15 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2002-02-04 23:05:15 +0100
commit6f9fdf4db2c68f482ec4ff3cadaea0537a4b13e1 (patch)
treeabbbeb9e68d3bc70e43d55d15b23db2b78adbf38 /gcc/c-common.h
parent79109502a02948f16653b44b434b8b4ef8aebd54 (diff)
downloadgcc-6f9fdf4db2c68f482ec4ff3cadaea0537a4b13e1.zip
gcc-6f9fdf4db2c68f482ec4ff3cadaea0537a4b13e1.tar.gz
gcc-6f9fdf4db2c68f482ec4ff3cadaea0537a4b13e1.tar.bz2
PR c/4475, c++/3780:
* c-common.def (SWITCH_STMT): Add SWITCH_TYPE operand. * c-common.h (SWITCH_TYPE): Define. * c-typeck.c (c_start_case): Set SWITCH_TYPE. * stmt.c (all_cases_count): Set lastval to thisval at end of loop. Rename spareness variable to sparseness. (expand_end_case_type): Renamed from expand_end_case, use orig_type if non-NULL instead of TREE_TYPE (orig_index). * tree.h (expand_end_case_type): Renamed from expand_end_case. (expand_end_case): Define using expand_end_case_type. * c-semantics.c (genrtl_switch_stmt): Pass SWITCH_TYPE to expand_end_case_type. * doc/c-tree.texi (SWITCH_STMT): Document SWITCH_TYPE. * semantics.c (begin_switch_stmt): Clear SWITCH_TYPE. (finish_switch_cond): Set SWITCH_TYPE. * gcc.dg/Wswitch.c: Fix typos. Don't return unconditionally before all tests. Move warning one line above to match where it C frontend emits. * gcc.dg/Wswitch-2.c: New test. * g++.dg/warn/Wswitch-1.C: New test. * g++.dg/warn/Wswitch-2.C: New test. From-SVN: r49497
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 3aaa513..c90cbfb 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -603,10 +603,12 @@ extern tree strip_array_types PARAMS ((tree));
#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
-/* SWITCH_STMT accessors. These give access to the condition and body
+/* SWITCH_STMT accessors. These give access to the condition, body and
+ original condition type (before any compiler conversions)
of the switch statement, respectively. */
#define SWITCH_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
#define SWITCH_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
+#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
/* CASE_LABEL accessors. These give access to the high and low values
of a case label, respectively. */