OSDN Git Service

* config/mcore/mcore.c Don't include assert.h.
[pf3gnuchains/gcc-fork.git] / gcc / java / jcf-parse.c
index eef75aa..d10791f 100644 (file)
@@ -34,14 +34,14 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "input.h"
 #include "javaop.h"
 #include "java-tree.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
 #include "parse.h"
 #include "ggc.h"
 #include "debug.h"
-#include "assert.h"
 #include "cgraph.h"
 #include "vecprim.h"
 #include "bitmap.h"
+#include "target.h"
 
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
@@ -79,9 +79,6 @@ static GTY(()) tree parse_roots[2];
 /* The METHOD_DECL for the current method.  */
 #define current_method parse_roots[1]
 
-/* A list of TRANSLATION_UNIT_DECLs for the files to be compiled.  */
-static GTY(()) VEC(tree,gc) *current_file_list;
-
 /* Line 0 in current file, if compiling from bytecode. */
 static location_t file_start_location;
 
@@ -557,12 +554,12 @@ handle_constant (JCF *jcf, int index, enum cpool_tag purpose)
 
     case CONSTANT_Long:
       index = handle_long_constant (jcf, cpool, CONSTANT_Long, index,
-                                   WORDS_BIG_ENDIAN);
+                                   targetm.words_big_endian ());
       break;
       
     case CONSTANT_Double:
       index = handle_long_constant (jcf, cpool, CONSTANT_Double, index,
-                                   FLOAT_WORDS_BIG_ENDIAN);
+                                   targetm.float_words_big_endian ());
       break;
 
     case CONSTANT_Float:
@@ -1073,7 +1070,7 @@ get_constant (JCF *jcf, int index)
        hi = JPOOL_UINT (jcf, index);
        lo = JPOOL_UINT (jcf, index+1);
 
-       if (FLOAT_WORDS_BIG_ENDIAN)
+       if (targetm.float_words_big_endian ())
          buf[0] = hi, buf[1] = lo;
        else
          buf[0] = lo, buf[1] = hi;
@@ -1570,7 +1567,7 @@ parse_class_file (void)
   gen_indirect_dispatch_tables (current_class);
 
   for (method = TYPE_METHODS (current_class);
-       method != NULL_TREE; method = TREE_CHAIN (method))
+       method != NULL_TREE; method = DECL_CHAIN (method))
     {
       JCF *jcf = current_jcf;
 
@@ -1682,7 +1679,7 @@ predefined_filename_p (tree node)
   unsigned ix;
   tree f;
 
-  for (ix = 0; VEC_iterate (tree, predefined_filenames, ix, f); ix++)
+  FOR_EACH_VEC_ELT (tree, predefined_filenames, ix, f)
     if (f == node)
       return 1;
 
@@ -1706,7 +1703,7 @@ java_emit_static_constructor (void)
 
       tree decl 
        = build_decl (input_location, FUNCTION_DECL, name,
-                     build_function_type (void_type_node, void_list_node));
+                     build_function_type_list (void_type_node, NULL_TREE));
 
       tree resdecl = build_decl (input_location,
                                 RESULT_DECL, NULL_TREE, void_type_node);
@@ -1733,7 +1730,7 @@ java_emit_static_constructor (void)
 
 
 void
-java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
+java_parse_file (void)
 {
   int filename_count = 0;
   location_t save_location = input_location;
@@ -1751,7 +1748,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
       int avail = 2000;
       finput = fopen (main_input_filename, "r");
       if (finput == NULL)
-       fatal_error ("can't open %s: %m", input_filename);
+       fatal_error ("can%'t open %s: %m", input_filename);
       list = XNEWVEC (char, avail);
       next = list;
       for (;;)
@@ -1839,9 +1836,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
            duplicate_class_warning (IDENTIFIER_POINTER (node));
          else
            {
-             tree file_decl = build_decl (input_location,
-                                          TRANSLATION_UNIT_DECL, node, NULL);
-             VEC_safe_push (tree, gc, current_file_list, file_decl);
+             build_translation_unit_decl (node);
              IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
            }
        }
@@ -1859,16 +1854,18 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
       const char *resource_filename;
       
       /* Only one resource file may be compiled at a time.  */
-      assert (VEC_length (tree, current_file_list) == 1);
+      gcc_assert (VEC_length (tree, all_translation_units) == 1);
 
-      resource_filename = IDENTIFIER_POINTER (DECL_NAME (VEC_index (tree, current_file_list, 0)));
+      resource_filename
+       = IDENTIFIER_POINTER
+           (DECL_NAME (VEC_index (tree, all_translation_units, 0)));
       compile_resource_file (resource_name, resource_filename);
 
       goto finish;
     }
 
   current_jcf = main_jcf;
-  for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+  FOR_EACH_VEC_ELT (tree, all_translation_units, ix, node)
     {
       unsigned char magic_string[4];
       char *real_path;
@@ -1886,11 +1883,11 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
 
       /* Close previous descriptor, if any */
       if (finput && fclose (finput))
-       fatal_error ("can't close input file %s: %m", main_input_filename);
+       fatal_error ("can%'t close input file %s: %m", main_input_filename);
       
       finput = fopen (filename, "rb");
       if (finput == NULL)
-       fatal_error ("can't open %s: %m", filename);
+       fatal_error ("can%'t open %s: %m", filename);
 
 #ifdef IO_BUFFER_SIZE
       setvbuf (finput, xmalloc (IO_BUFFER_SIZE),
@@ -1906,8 +1903,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
       if (magic == 0xcafebabe)
        {
          CLASS_FILE_P (node) = 1;
-         current_jcf = GGC_NEW (JCF);
-         JCF_ZERO (current_jcf);
+         current_jcf = ggc_alloc_cleared_JCF ();
          current_jcf->read_state = finput;
          current_jcf->filbuf = jcf_filbuf_from_stdio;
          jcf_parse (current_jcf);
@@ -1924,8 +1920,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
        }
       else if (magic == (JCF_u4)ZIPMAGIC)
        {
-         main_jcf = GGC_NEW (JCF);
-         JCF_ZERO (main_jcf);
+         main_jcf = ggc_alloc_cleared_JCF ();
          main_jcf->read_state = finput;
          main_jcf->filbuf = jcf_filbuf_from_stdio;
          linemap_add (line_table, LC_ENTER, false, filename, 0);
@@ -1957,7 +1952,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
        }
     }
 
-  for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+  FOR_EACH_VEC_ELT (tree, all_translation_units, ix, node)
     {
       input_location = DECL_SOURCE_LOCATION (node);
       if (CLASS_FILE_P (node))
@@ -2181,8 +2176,7 @@ process_zip_dir (FILE *finput)
 
       class_name = compute_class_name (zdir);
       file_name  = XNEWVEC (char, zdir->filename_length+1);
-      jcf = GGC_NEW (JCF);
-      JCF_ZERO (jcf);
+      jcf = ggc_alloc_cleared_JCF ();
 
       strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
       file_name [zdir->filename_length] = '\0';