OSDN Git Service

* exp_pakd.adb (Create_Packed_Array_Type): Always use a modular type
[pf3gnuchains/gcc-fork.git] / gcc / java / lang.c
index c431141..22fe4ff 100644 (file)
@@ -45,6 +45,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "tree-dump.h"
 #include "opts.h"
 #include "options.h"
+#include "except.h"
 
 static bool java_init (void);
 static void java_finish (void);
@@ -53,7 +54,7 @@ static bool java_post_options (const char **);
 
 static int java_handle_option (size_t scode, const char *arg, int value);
 static void put_decl_string (const char *, int);
-static void put_decl_node (tree);
+static void put_decl_node (tree, int);
 static void java_print_error_function (diagnostic_context *, const char *,
                                       diagnostic_info *);
 static int merge_init_test_initialization (void * *, void *);
@@ -64,6 +65,8 @@ static bool java_decl_ok_for_sibcall (const_tree);
 
 static enum classify_record java_classify_record (tree type);
 
+static tree java_eh_personality (void);
+
 #ifndef TARGET_OBJECT_SUFFIX
 # define TARGET_OBJECT_SUFFIX ".o"
 #endif
@@ -111,8 +114,7 @@ static int dependency_tracking = 0;
 #define DEPEND_TARGET_SET 4
 #define DEPEND_FILE_ALREADY_SET 8
 
-struct language_function GTY(())
-{
+struct GTY(()) language_function {
   int unused;
 };
 
@@ -130,8 +132,6 @@ struct language_function GTY(())
 #define LANG_HOOKS_POST_OPTIONS java_post_options
 #undef LANG_HOOKS_PARSE_FILE
 #define LANG_HOOKS_PARSE_FILE java_parse_file
-#undef LANG_HOOKS_MARK_ADDRESSABLE
-#define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
@@ -161,8 +161,14 @@ struct language_function GTY(())
 #undef LANG_HOOKS_ATTRIBUTE_TABLE
 #define LANG_HOOKS_ATTRIBUTE_TABLE java_attribute_table
 
+#undef LANG_HOOKS_EH_PERSONALITY
+#define LANG_HOOKS_EH_PERSONALITY java_eh_personality
+
+#undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
+#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP  true
+
 /* Each front end provides its own.  */
-const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
 /*
  * process java-specific compiler command-line options
@@ -355,10 +361,13 @@ put_decl_string (const char *str, int len)
   decl_bufpos += len;
 }
 
-/* Append to decl_buf a printable name for NODE. */
+/* Append to decl_buf a printable name for NODE.
+   Depending on VERBOSITY, more information about NODE
+   is printed. Read the comments of decl_printable_name in
+   langhooks.h for more.  */
 
 static void
-put_decl_node (tree node)
+put_decl_node (tree node, int verbosity)
 {
   int was_pointer = 0;
   if (TREE_CODE (node) == POINTER_TYPE)
@@ -370,17 +379,32 @@ put_decl_node (tree node)
     {
       if (TREE_CODE (node) == FUNCTION_DECL)
        {
+         if (verbosity == 0 && DECL_NAME (node))
+         /* We have been instructed to just print the bare name
+            of the function.  */
+           {
+             put_decl_node (DECL_NAME (node), 0);
+             return;
+           }
+
          /* We want to print the type the DECL belongs to. We don't do
             that when we handle constructors. */
          if (! DECL_CONSTRUCTOR_P (node)
-             && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
+             && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node)
+              /* We want to print qualified DECL names only
+                 if verbosity is higher than 1.  */
+              && verbosity >= 1)
            {
-             put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
+             put_decl_node (TYPE_NAME (DECL_CONTEXT (node)),
+                               verbosity);
              put_decl_string (".", 1);
            }
          if (! DECL_CONSTRUCTOR_P (node))
-           put_decl_node (DECL_NAME (node));
-         if (TREE_TYPE (node) != NULL_TREE)
+           put_decl_node (DECL_NAME (node), verbosity);
+         if (TREE_TYPE (node) != NULL_TREE
+              /* We want to print function parameters only if verbosity
+                 is higher than 2.  */
+              && verbosity >= 2)
            {
              int i = 0;
              tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
@@ -391,19 +415,22 @@ put_decl_node (tree node)
                {
                  if (i > 0)
                    put_decl_string (",", 1);
-                 put_decl_node (TREE_VALUE (args));
+                 put_decl_node (TREE_VALUE (args), verbosity);
                }
              put_decl_string (")", 1);
            }
        }
       else
-       put_decl_node (DECL_NAME (node));
+       put_decl_node (DECL_NAME (node), verbosity);
     }
   else if (TYPE_P (node) && TYPE_NAME (node) != NULL_TREE)
     {
-      if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
+      if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node)
+          /* Print detailed array information only if verbosity is higher
+            than 2.  */
+          && verbosity >= 2)
        {
-         put_decl_node (TYPE_ARRAY_ELEMENT (node));
+         put_decl_node (TYPE_ARRAY_ELEMENT (node), verbosity);
          put_decl_string("[]", 2);
        }
       else if (node == promoted_byte_type_node)
@@ -417,7 +444,7 @@ put_decl_node (tree node)
       else if (node == void_type_node && was_pointer)
        put_decl_string ("null", 4);
       else
-       put_decl_node (TYPE_NAME (node));
+       put_decl_node (TYPE_NAME (node), verbosity);
     }
   else if (TREE_CODE (node) == IDENTIFIER_NODE)
     put_decl_string (IDENTIFIER_POINTER (node), IDENTIFIER_LENGTH (node));
@@ -434,10 +461,7 @@ const char *
 lang_printable_name (tree decl, int v)
 {
   decl_bufpos = 0;
-  if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
-    put_decl_node (DECL_NAME (decl));
-  else
-    put_decl_node (decl);
+  put_decl_node (decl, v);
   put_decl_string ("", 1);
   return decl_buf;
 }
@@ -563,7 +587,7 @@ java_post_options (const char **pfilename)
     {
       if (dependency_tracking)
        {
-         char *dot;
+         const char *dot;
 
          /* If the target is set and the output filename is set, then
             there's no processing to do here.  Otherwise we must
@@ -865,4 +889,18 @@ java_classify_record (tree type)
   return RECORD_IS_CLASS;
 }
 
+static GTY(()) tree java_eh_personality_decl;
+
+static tree
+java_eh_personality (void)
+{
+  if (!java_eh_personality_decl)
+    java_eh_personality_decl
+      = build_personality_function (USING_SJLJ_EXCEPTIONS
+                                   ? "__gcj_personality_sj0"
+                                   : "__gcj_personality_v0");
+
+  return java_eh_personality_decl;
+}
+
 #include "gt-java-lang.h"