summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-23 01:29:08 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-23 01:29:08 +0000
commitb96dc1214cf672f219471ff29ee90c6c109393c5 (patch)
treea494e1e283e1b20afad26e4574a3526f1d4d5e5b /gcc/c-common.c
parentd8fe3273bd13fa0948df8315ae7a8b2f25e36d7f (diff)
downloadgcc-b96dc1214cf672f219471ff29ee90c6c109393c5.tar.gz
* c-common.h (default_conversion): Remove.
(perform_integral_promotions): Add. * c-tree.h (default_conversion): Add. * c-typeck.c (perform_integral_promotions): New, split out from default_conversion. * c-common.c (check_case_value): Use perform_integral_promotions, not default_conversion. (c_add_case_label): Don't continue processing case label after found to be pointer. cp: * cp-tree.h (perform_integral_promotions): Remove. (default_conversion): Add. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96916 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a18520d9e0d..d4b9d5cda8e 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1427,15 +1427,14 @@ check_case_value (tree value)
value = fold (value);
}
- if (TREE_CODE (value) != INTEGER_CST
- && value != error_mark_node)
+ if (TREE_CODE (value) == INTEGER_CST)
+ /* Promote char or short to int. */
+ value = perform_integral_promotions (value);
+ else if (value != error_mark_node)
{
error ("case label does not reduce to an integer constant");
value = error_mark_node;
}
- else
- /* Promote char or short to int. */
- value = default_conversion (value);
constant_expression_warning (value);
@@ -3514,7 +3513,10 @@ c_add_case_label (splay_tree cases, tree cond, tree orig_type,
&& POINTER_TYPE_P (TREE_TYPE (low_value)))
|| (high_value && TREE_TYPE (high_value)
&& POINTER_TYPE_P (TREE_TYPE (high_value))))
- error ("pointers are not permitted as case values");
+ {
+ error ("pointers are not permitted as case values");
+ goto error_out;
+ }
/* Case ranges are a GNU extension. */
if (high_value && pedantic)