diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2010-10-27 17:42:36 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-10-27 17:42:36 -0400 |
commit | 81f0bab25ec7d17b84e94ee7322aa953a75584a7 (patch) | |
tree | ffd5d52f502eeecf4274ffa2c4c9a0e6c6360099 | |
parent | 5ac13b8e0c688dcf1251aee3f90eddfc1e5ba43f (diff) | |
download | gcc-81f0bab25ec7d17b84e94ee7322aa953a75584a7.zip gcc-81f0bab25ec7d17b84e94ee7322aa953a75584a7.tar.gz gcc-81f0bab25ec7d17b84e94ee7322aa953a75584a7.tar.bz2 |
c-common.c (check_case_value): Remove special C++ code.
c-family/
* c-common.c (check_case_value): Remove special C++ code.
cp/
* decl.c (finish_case_label): Use decl_constant_value.
From-SVN: r166019
-rw-r--r-- | gcc/c-family/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 16 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 |
4 files changed, 11 insertions, 16 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4f30512..1098129e 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2010-10-27 Jason Merrill <jason@redhat.com> + + * c-common.c (check_case_value): Remove special C++ code. + 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (enum rid): Added RID_READWRITE, RID_ASSIGN, diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index a847be2..98568e8 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -2588,22 +2588,6 @@ check_case_value (tree value) if (value == NULL_TREE) return value; - /* ??? Can we ever get nops here for a valid case value? We - shouldn't for C. */ - STRIP_TYPE_NOPS (value); - /* In C++, the following is allowed: - - const int i = 3; - switch (...) { case i: ... } - - So, we try to reduce the VALUE to a constant that way. */ - if (c_dialect_cxx ()) - { - value = decl_constant_value (value); - STRIP_TYPE_NOPS (value); - value = fold (value); - } - if (TREE_CODE (value) == INTEGER_CST) /* Promote char or short to int. */ value = perform_integral_promotions (value); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8402c72..6efa96a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,8 @@ 2010-10-27 Gabriel Dos Reis <gdr@cse.tamu.edu> Jason Merrill <jason@redhat.com> + * decl.c (finish_case_label): Use decl_constant_value. + * method.c (synthesized_method_walk): Track constexprness too. (process_subob_fn, walk_field_subobs): Likewise. (implicitly_declare_fn): Set DECL_DECLARED_CONSTEXPR_P. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8b2af9cd..d73d109 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2938,6 +2938,11 @@ finish_case_label (location_t loc, tree low_value, tree high_value) if (!check_switch_goto (switch_stack->level)) return error_mark_node; + if (low_value) + low_value = decl_constant_value (low_value); + if (high_value) + high_value = decl_constant_value (high_value); + r = c_add_case_label (loc, switch_stack->cases, cond, SWITCH_STMT_TYPE (switch_stack->switch_stmt), low_value, high_value); |