aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb@suse.de>2004-07-20 09:57:13 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2004-07-20 09:57:13 +0000
commita6c0a76c5f9eb216b5f08ffc4624a6d039ca3977 (patch)
tree134a4370313a4f575f6aa704b0deb37112d1b859 /gcc/cp
parent5794581363d5c74938f0e200b4c899a5b26229e9 (diff)
downloadgcc-a6c0a76c5f9eb216b5f08ffc4624a6d039ca3977.zip
gcc-a6c0a76c5f9eb216b5f08ffc4624a6d039ca3977.tar.gz
gcc-a6c0a76c5f9eb216b5f08ffc4624a6d039ca3977.tar.bz2
c-common.h (check_case_value): Remove prototype.
* c-common.h (check_case_value): Remove prototype. (c_add_case_label): Adjust prototype. * c-common.c (check_case_value): Make static. (check_case_bounds): New function. (c_add_case_label): Use it. Take new argument orig_type. * c-typeck.c (struct c_switch): New orig_type field. (c_start_case): Set it. (do_case): Pass it to c_add_case_label. * expr.c (expand_expr_real_1): Don't warn for out-of-bounds cases from here. Add the labels in reverse order. * stmt.c (struct case_node): Adjust comment. Remove balance field. (add_case_node): Return nothing, don't check for duplicate cases. Insert new case nodes in a list, not in an AVL tree. (expand_end_case_type): Don't turn a case tree into a case list. (case_tree2list): Remove. * tree.h (add_case_node): Adjust prototype. cp/ * cp-tree.h (struct lang_decl_flags): Unify the template_info and thunk_alias, and the access and virtual_offset fields. (THUNK_VIRTUAL_OFFSET, THUNK_ALIAS): Adjust. * decl.c (finish_case_label): Update c_add_case_node call. testsuite/ * testsuite/gcc.dg/switch-warn-1.c: New test. * testsuite/gcc.dg/switch-warn-2.c: New test. * gcc.c-torture/compile/pr14730.c: Update From-SVN: r84947
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-tree.h20
-rw-r--r--gcc/cp/decl.c3
3 files changed, 17 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 27e45ee..0a038fc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-07-20 Steven Bosscher <stevenb@suse.de>
+
+ * cp-tree.h (struct lang_decl_flags): Unify the template_info and
+ thunk_alias, and the access and virtual_offset fields.
+ (THUNK_VIRTUAL_OFFSET, THUNK_ALIAS): Adjust.
+ * decl.c (finish_case_label): Update c_add_case_node call.
+
2004-07-19 Mark Mitchell <mark@codesourcery.com>
Revert patch for PR c++/16623.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ca7eae3..4b717de 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1544,29 +1544,25 @@ struct lang_decl_flags GTY(())
unsigned this_thunk_p : 1;
union lang_decl_u {
- /* In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
+ /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
+ THUNK_ALIAS.
+ In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
DECL_TEMPLATE_INFO. */
tree GTY ((tag ("0"))) template_info;
/* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
struct cp_binding_level * GTY ((tag ("1"))) level;
-
- /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
- THUNK_ALIAS. */
- tree GTY ((tag ("2"))) thunk_alias;
} GTY ((desc ("%1.u1sel"))) u;
union lang_decl_u2 {
- /* This is DECL_ACCESS. */
+ /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
+ THUNK_VIRTUAL_OFFSET.
+ Otherwise this is DECL_ACCESS. */
tree GTY ((tag ("0"))) access;
/* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
int GTY ((tag ("1"))) discriminator;
-
- /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
- THUNK_VIRTUAL_OFFSET. */
- tree GTY((tag ("2"))) virtual_offset;
} GTY ((desc ("%1.u2sel"))) u2;
};
@@ -2827,11 +2823,11 @@ struct lang_decl GTY(())
binfos.) */
#define THUNK_VIRTUAL_OFFSET(DECL) \
- (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->virtual_offset)
+ (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
/* A thunk which is equivalent to another thunk. */
#define THUNK_ALIAS(DECL) \
- (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.thunk_alias)
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.template_info)
/* For thunk NODE, this is the FUNCTION_DECL thunked to. */
#define THUNK_TARGET(NODE) \
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 874cfcb..2d4fa89 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2444,7 +2444,8 @@ finish_case_label (tree low_value, tree high_value)
if (cond && TREE_CODE (cond) == TREE_LIST)
cond = TREE_VALUE (cond);
- r = c_add_case_label (switch_stack->cases, cond, low_value, high_value);
+ r = c_add_case_label (switch_stack->cases, cond, TREE_TYPE (cond),
+ low_value, high_value);
check_switch_goto (switch_stack->level);