public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove Java references in source code.
@ 2017-07-11 14:30 Martin Liška
  2017-07-11 14:36 ` [RFC] Remaining references of Java Martin Liška
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Martin Liška @ 2017-07-11 14:30 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

Hello.

Patch removes some remaining references in gcc/ subfolder.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?

Martin

gcc/ChangeLog:

2017-07-11  Martin Liska  <mliska@suse.cz>

	* cfgexpand.c (expand_gimple_basic_block): Remove dead comment.
	* dwarf2out.c (is_java): Remove the function.
	(output_pubname): Remove usage of the function.
	(lower_bound_default): Remove usage of DW_LANG_Java.
	(gen_compile_unit_die): Likewise.
	* gcc.c: Remove compiler defaults for .java and .zip files.
	* gimple-expr.c (remove_suffix): Change as there's no longer
	extension than 4-letter one.
	* gimplify.c (mostly_copy_tree_r): Remove Java-special part.
	(gimplify_save_expr): Likewise.
	* ipa-utils.h (polymorphic_type_binfo_p): Remove the comment
	as it's possible even for other languages than Java.
	* langhooks.h (struct lang_hooks): Remove Java from a comment.
	* lto-opts.c (lto_write_options): Remove reference to Java.
	* opts.c (strip_off_ending): Update file extension handling.
	* tree-cfg.c (verify_gimple_call): Remove comment with Java.
	* tree-eh.c (lower_resx): Likewise.
	* tree.c (free_lang_data_in_type): Remove dead code.
	(find_decls_types_r): Likewise.
	(build_common_builtin_nodes): Remove Java from a comment.
	(verify_type): Remove dead code.
	* varasm.c (assemble_external): Remove Java from a comment.
---
  gcc/cfgexpand.c   |  2 --
  gcc/dwarf2out.c   | 19 +++----------------
  gcc/gcc.c         |  2 --
  gcc/gimple-expr.c |  4 ++--
  gcc/gimplify.c    | 24 +++++-------------------
  gcc/ipa-utils.h   |  3 ---
  gcc/langhooks.h   |  2 +-
  gcc/lto-opts.c    |  4 ++--
  gcc/opts.c        |  4 ++--
  gcc/tree-cfg.c    |  2 --
  gcc/tree-eh.c     |  8 +-------
  gcc/tree.c        | 48 ++----------------------------------------------
  gcc/varasm.c      |  2 +-
  13 files changed, 19 insertions(+), 105 deletions(-)



[-- Attachment #2: 0001-Remove-Java-references-in-source-code.patch --]
[-- Type: text/x-patch, Size: 13929 bytes --]

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c427a89bab0..3e1d24db876 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5497,8 +5497,6 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
       if (elt)
 	emit_label (*elt);
 
-      /* Java emits line number notes in the top of labels.
-	 ??? Make this go away once line number notes are obsoleted.  */
       BB_HEAD (bb) = NEXT_INSN (last);
       if (NOTE_P (BB_HEAD (bb)))
 	BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb));
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c277d27e8e8..491c778d58a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -5049,16 +5049,6 @@ is_cxx (const_tree decl)
   return is_cxx ();
 }
 
-/* Return TRUE if the language is Java.  */
-
-static inline bool
-is_java (void)
-{
-  unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language);
-
-  return lang == DW_LANG_Java;
-}
-
 /* Return TRUE if the language is Fortran.  */
 
 static inline bool
@@ -10756,8 +10746,8 @@ output_pubname (dw_offset die_offset, pubname_entry *entry)
         case DW_TAG_enumerator:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags,
                                           GDB_INDEX_SYMBOL_KIND_VARIABLE);
-          if (!is_cxx () && !is_java ())
-            GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
+	  if (!is_cxx ())
+	    GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;
         case DW_TAG_subprogram:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags,
@@ -10785,7 +10775,7 @@ output_pubname (dw_offset die_offset, pubname_entry *entry)
         case DW_TAG_union_type:
         case DW_TAG_enumeration_type:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
-          if (!is_cxx () && !is_java ())
+	  if (!is_cxx ())
 	    GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;
         default:
@@ -19830,7 +19820,6 @@ lower_bound_default (void)
     case DW_LANG_C_plus_plus_14:
     case DW_LANG_ObjC:
     case DW_LANG_ObjC_plus_plus:
-    case DW_LANG_Java:
       return 0;
     case DW_LANG_Fortran77:
     case DW_LANG_Fortran90:
@@ -23593,8 +23582,6 @@ gen_compile_unit_die (const char *filename)
 		language = DW_LANG_Fortran08;
 	    }
 	}
-      else if (strcmp (language_string, "GNU Java") == 0)
-	language = DW_LANG_Java;
       else if (strcmp (language_string, "GNU Objective-C") == 0)
 	language = DW_LANG_ObjC;
       else if (strcmp (language_string, "GNU Objective-C++") == 0)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index e8e3d6687c3..ea8858da5d1 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1306,8 +1306,6 @@ static const struct compiler default_compilers[] =
   {".f08", "#Fortran", 0, 0, 0}, {".F08", "#Fortran", 0, 0, 0},
   {".r", "#Ratfor", 0, 0, 0},
   {".p", "#Pascal", 0, 0, 0}, {".pas", "#Pascal", 0, 0, 0},
-  {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0},
-  {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0},
   {".go", "#Go", 0, 1, 0},
   /* Next come the entries for C.  */
   {".c", "@c", 0, 0, 1},
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index 9d8034c3192..13e55ef55fe 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -388,14 +388,14 @@ copy_var_decl (tree var, tree name, tree type)
 /* Strip off a legitimate source ending from the input string NAME of
    length LEN.  Rather than having to know the names used by all of
    our front ends, we strip off an ending of a period followed by
-   up to five characters.  (Java uses ".class".)  */
+   up to four characters.  (like ".cpp".)  */
 
 static inline void
 remove_suffix (char *name, int len)
 {
   int i;
 
-  for (i = 2;  i < 8 && len > i;  i++)
+  for (i = 2;  i < 7 && len > i;  i++)
     {
       if (name[len - i] == '.')
 	{
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 641a8210dad..d456c3ef301 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -818,12 +818,7 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
   /* Stop at types, decls, constants like copy_tree_r.  */
   else if (TREE_CODE_CLASS (code) == tcc_type
 	   || TREE_CODE_CLASS (code) == tcc_declaration
-	   || TREE_CODE_CLASS (code) == tcc_constant
-	   /* We can't do anything sensible with a BLOCK used as an
-	      expression, but we also can't just die when we see it
-	      because of non-expression uses.  So we avert our eyes
-	      and cross our fingers.  Silly Java.  */
-	   || code == BLOCK)
+	   || TREE_CODE_CLASS (code) == tcc_constant)
     *walk_subtrees = 0;
 
   /* Cope with the statement expression extension.  */
@@ -5807,19 +5802,10 @@ gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
   /* If the SAVE_EXPR has not been resolved, then evaluate it once.  */
   if (!SAVE_EXPR_RESOLVED_P (*expr_p))
     {
-      /* The operand may be a void-valued expression such as SAVE_EXPRs
-	 generated by the Java frontend for class initialization.  It is
-	 being executed only for its side-effects.  */
-      if (TREE_TYPE (val) == void_type_node)
-	{
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_stmt, fb_none);
-	  val = NULL;
-	}
-      else
-	/* The temporary may not be an SSA name as later abnormal and EH
-	   control flow may invalidate use/def domination.  */
-	val = get_initialized_tmp_var (val, pre_p, post_p, false);
+      gcc_assert (TREE_TYPE (val) != void_type_node);
+      /* The temporary may not be an SSA name as later abnormal and EH
+	 control flow may invalidate use/def domination.  */
+      val = get_initialized_tmp_var (val, pre_p, post_p, false);
 
       TREE_OPERAND (*expr_p, 0) = val;
       SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index e992f65948b..f061c84c8a9 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -169,9 +169,6 @@ possible_polymorphic_call_target_p (struct cgraph_edge *e,
 inline bool
 polymorphic_type_binfo_p (const_tree binfo)
 {
-  /* See if BINFO's type has an virtual table associtated with it.
-     Check is defensive because of Java FE produces BINFOs
-     without BINFO_TYPE set.   */
   return (BINFO_TYPE (binfo) && TYPE_BINFO (BINFO_TYPE (binfo))
 	  && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo))));
 }
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index b2f0f922b89..88f6f71b559 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -293,7 +293,7 @@ struct lang_hooks_for_lto
 struct lang_hooks
 {
   /* String identifying the front end and optionally language standard
-     version, e.g. "GNU C++98" or "GNU Java".  */
+     version, e.g. "GNU C++98".  */
   const char *name;
 
   /* sizeof (struct lang_identifier), so make_node () creates
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 9618bfb318f..641b2795b2c 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -108,8 +108,8 @@ lto_write_options (void)
 	gcc_unreachable ();
       }
   /* The default -fmath-errno, -fsigned-zeros and -ftrapping-math change
-     depending on the language (they can be disabled by the Ada and Java
-     front-ends).  Pass thru conservative standard settings.  */
+     depending on the language (they can be disabled by the Ada front-end).
+     Pass thru conservative standard settings.  */
   if (!global_options_set.x_flag_errno_math)
     append_to_collect_gcc_options (&temporary_obstack, &first_p,
 				   global_options.x_flag_errno_math
diff --git a/gcc/opts.c b/gcc/opts.c
index 7555ed55434..12acba1437d 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -139,13 +139,13 @@ set_struct_debug_option (struct gcc_options *opts, location_t loc,
 /* Strip off a legitimate source ending from the input string NAME of
    length LEN.  Rather than having to know the names used by all of
    our front ends, we strip off an ending of a period followed by
-   up to five characters.  (Java uses ".class".)  */
+   up to fource characters.  (C++ uses ".cpp".)  */
 
 void
 strip_off_ending (char *name, int len)
 {
   int i;
-  for (i = 2; i < 6 && len > i; i++)
+  for (i = 2; i < 5 && len > i; i++)
     {
       if (name[len - i] == '.')
 	{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 248373194f5..83e4ee60e9f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3497,8 +3497,6 @@ verify_gimple_call (gcall *stmt)
       && !useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (fntype))
       /* ???  At least C++ misses conversions at assignments from
 	 void * call results.
-	 ???  Java is completely off.  Especially with functions
-	 returning java.lang.Object.
 	 For now simply allow arbitrary pointer type conversions.  */
       && !(POINTER_TYPE_P (TREE_TYPE (lhs))
 	   && POINTER_TYPE_P (TREE_TYPE (fntype))))
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 79d02adbade..c68d71a5e54 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1564,12 +1564,6 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 /* Decide whether or not we are going to duplicate the finally block.
    There are several considerations.
 
-   First, if this is Java, then the finally block contains code
-   written by the user.  It has line numbers associated with it,
-   so duplicating the block means it's difficult to set a breakpoint.
-   Since controlling code generation via -g is verboten, we simply
-   never duplicate code without optimization.
-
    Second, we'd like to prevent egregious code growth.  One way to
    do this is to estimate the size of the finally block, multiply
    that by the number of copies we'd need to make, and compare against
@@ -3286,7 +3280,7 @@ lower_resx (basic_block bb, gresx *stmt,
 	 _Unwind_Resume library function.  */
 
       /* The ARM EABI redefines _Unwind_Resume as __cxa_end_cleanup
-	 with no arguments for C++ and Java.  Check for that.  */
+	 with no arguments for C++.  Check for that.  */
       if (src_r->use_cxa_end_cleanup)
 	{
 	  fn = builtin_decl_implicit (BUILT_IN_CXA_END_CLEANUP);
diff --git a/gcc/tree.c b/gcc/tree.c
index ca28afad0f2..678b2708910 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5162,8 +5162,6 @@ free_lang_data_in_type (tree type)
 	  /* C++ FE uses TREE_PURPOSE to store initial values.  */
 	  TREE_PURPOSE (p) = NULL;
 	}
-      /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-      TYPE_MINVAL (type) = NULL;
     }
   if (TREE_CODE (type) == METHOD_TYPE)
     {
@@ -5174,8 +5172,6 @@ free_lang_data_in_type (tree type)
 	  /* C++ FE uses TREE_PURPOSE to store initial values.  */
 	  TREE_PURPOSE (p) = NULL;
 	}
-      /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-      TYPE_MINVAL (type) = NULL;
     }
 
   /* Remove members that are not actually FIELD_DECLs from the field
@@ -5661,16 +5657,7 @@ find_decls_types_r (tree *tp, int *ws, void *data)
 	  tree tem;
 	  FOR_EACH_VEC_ELT (*BINFO_BASE_BINFOS (TYPE_BINFO (t)), i, tem)
 	    fld_worklist_push (TREE_TYPE (tem), fld);
-	  tem = BINFO_VIRTUALS (TYPE_BINFO (t));
-	  if (tem
-	      /* The Java FE overloads BINFO_VIRTUALS for its own purpose.  */
-	      && TREE_CODE (tem) == TREE_LIST)
-	    do
-	      {
-		fld_worklist_push (TREE_VALUE (tem), fld);
-		tem = TREE_CHAIN (tem);
-	      }
-	    while (tem);
+	  fld_worklist_push (BINFO_VIRTUALS (TYPE_BINFO (t)), fld);
 	}
       if (RECORD_OR_UNION_TYPE_P (t))
 	{
@@ -10799,7 +10786,7 @@ build_common_builtin_nodes (void)
 			ECF_PURE | ECF_NOTHROW | ECF_LEAF);
 
   /* If there's a possibility that we might use the ARM EABI, build the
-    alternate __cxa_end_cleanup node used to resume from C++ and Java.  */
+    alternate __cxa_end_cleanup node used to resume from C++.  */
   if (targetm.arm_eabi_unwinder)
     {
       ftype = build_function_type_list (void_type_node, NULL_TREE);
@@ -14029,15 +14016,6 @@ verify_type (const_tree t)
 				     TREE_TYPE (TYPE_MIN_VALUE (t))
 	 but does not for C sizetypes in LTO.  */
     }
-  /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-  else if (TYPE_MINVAL (t)
-	   && ((TREE_CODE (t) != METHOD_TYPE && TREE_CODE (t) != FUNCTION_TYPE)
-	       || in_lto_p))
-    {
-      error ("TYPE_MINVAL non-NULL");
-      debug_tree (TYPE_MINVAL (t));
-      error_found = true;
-    }
 
   /* Check various uses of TYPE_MAXVAL.  */
   if (RECORD_OR_UNION_TYPE_P (t))
@@ -14109,14 +14087,6 @@ verify_type (const_tree t)
 	  debug_tree (TYPE_BINFO (t));
 	  error_found = true;
 	}
-      /* FIXME: Java builds invalid empty binfos that do not have
-         TREE_TYPE set.  */
-      else if (TREE_TYPE (TYPE_BINFO (t)) != TYPE_MAIN_VARIANT (t) && 0)
-	{
-	  error ("TYPE_BINFO type is not TYPE_MAIN_VARIANT");
-	  debug_tree (TREE_TYPE (TYPE_BINFO (t)));
-	  error_found = true;
-	}
     }
   else if (TYPE_LANG_SLOT_1 (t) && in_lto_p)
     {
@@ -14271,20 +14241,6 @@ verify_type (const_tree t)
       error ("TYPE_STRING_FLAG is set on wrong type code");
       error_found = true;
     }
-  else if (TYPE_STRING_FLAG (t))
-    {
-      const_tree b = t;
-      if (TREE_CODE (b) == ARRAY_TYPE)
-	b = TREE_TYPE (t);
-      /* Java builds arrays with TYPE_STRING_FLAG of promoted_char_type
-	 that is 32bits.  */
-      if (TREE_CODE (b) != INTEGER_TYPE)
-	{
-	  error ("TYPE_STRING_FLAG is set on type that does not look like "
-		 "char nor array of chars");
-	  error_found = true;
-	}
-    }
   
   /* ipa-devirt makes an assumption that TYPE_METHOD_BASETYPE is always
      TYPE_MAIN_VARIANT and it would be odd to add methods only to variatns
diff --git a/gcc/varasm.c b/gcc/varasm.c
index fbaebc1b5c0..45611a9a858 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2403,7 +2403,7 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
   gcc_assert (asm_out_file);
 
   /* In a perfect world, the following condition would be true.
-     Sadly, the Java and Go front ends emit assembly *from the front end*,
+     Sadly, the Go front end emit assembly *from the front end*,
      bypassing the call graph.  See PR52739.  Fix before GCC 4.8.  */
 #if 0
   /* This function should only be called if we are expanding, or have


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-07-31 22:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11 14:30 [PATCH] Remove Java references in source code Martin Liška
2017-07-11 14:36 ` [RFC] Remaining references of Java Martin Liška
2017-07-25 11:55   ` Richard Biener
2017-07-25 18:47     ` Jan Hubicka
2017-07-31  7:44     ` Martin Liška
2017-07-31 22:22     ` Joseph Myers
2017-07-14  7:35 ` [PATCH] Remove Java references in source code Jeff Law
2017-07-14 17:43 ` Rainer Orth
2017-07-14 18:18   ` Jeff Law
2017-07-15  7:37 ` Eric Botcazou
2017-07-17 11:34   ` Martin Liška
2017-07-18 11:33   ` [PATCH] Remove a Java-specific hunk Martin Liška
2017-07-19 10:24     ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).