This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to start default_conversion cleanup


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]