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] compiling gcc with a C++ compiler 2/n


On 5/13/07, Thomas Neumann <tneumann@users.sourceforge.net> wrote:
Hi,

Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 124656)
+++ gcc/c-decl.c	(working copy)
@@ -3765,7 +3765,7 @@ build_compound_literal (tree type, tree
    return error_mark_node;

  stmt = build_stmt (DECL_EXPR, decl);
-  complit = build1 (COMPOUND_LITERAL_EXPR, type, stmt);
+  complit = build1 ((enum tree_code) COMPOUND_LITERAL_EXPR, type, stmt);

You have to give this part a little more thought. As COMPOUND_LITERAL_EXPR is outside the range of the enum which makes the code undefined for C++ (while still being defined for C). This case is where you blindly converting the code without thinking about what is the differences between C and C++. The C++ front-end will end up with the same issue too.

As for:
-  vars = c_parser_omp_var_list_parens (parser, 0, NULL);
+  vars = c_parser_omp_var_list_parens (parser, (enum omp_clause_code) 0, NULL);

Use OMP_CLAUSE_ERROR instead of the ugly cast.

For:
@@ -4317,7 +4318,8 @@ c_expand_expr (tree exp, rtx target, enu
	   literal, then return the variable.  */
	tree decl = COMPOUND_LITERAL_EXPR_DECL (exp);
	emit_local_var (decl);
-	return expand_expr_real (decl, target, tmode, modifier, alt_rtl);
+	return expand_expr_real (decl, target, tmode,
+ 				 (enum expand_modifier) modifier, alt_rtl);
      }

Change the whole langhook instead of adding a cast, yes that means
moving around where enum expand_modifier is declared but who cares, it
is just one enum and that should fix all front-ends at the same time.
In a way these are all seperate changes and should be submitted
seperately.

Thanks,
Andrew Pinski


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