This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to start default_conversion cleanup
- From: Zack Weinberg <zack at codesourcery dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Mar 2005 10:38:46 -0800
- Subject: Re: Patch to start default_conversion cleanup
- References: <Pine.LNX.4.61.0503221757490.6951@digraph.polyomino.org.uk>
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> This patch changes the function which C-family front ends need to
> provide to c-common from default_conversion to
> perform_integral_promotions, with associated C and C++ header
> changes, creating such a function for C from the relevant parts of
> default_conversion. Bootstrapped with no regressions on
> x86_64-unknown-linux-gnu. OK to commit?
Yes; see also some notes below.
> converting CONST_DECLs to their values (which I don't think should
> ever be needed for C)
Enumerators are CONST_DECLs, but build_external_ref already converts
them to their values.
> @@ -3514,7 +3513,10 @@ c_add_case_label (splay_tree cases, tree
> && 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;
> + }
As long as you are tweaking in here, why don't you move the call to
create_artificial_label all the way down to where it says
/* Add a CASE_LABEL to the statement tree. */
so that garbage is not created in the error cases. Also, the case
for low_value > high_value should probably drop out early rather
than insert anything, and it would be friendly to move the pedwarn
to a point where it does not happen in any error case.
zw