OSDN Git Service

* dbxout.c (lastfile, cwd): Fix `unused' warning.
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 60ca664..468ee09 100644 (file)
@@ -70,6 +70,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 
 #include "tree.h"
 #include "rtl.h"
@@ -135,11 +137,71 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #define STABS_GCC_MARKER "gcc2_compiled."
 #endif
 
+enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
+
+/* Structure recording information about a C data type.
+   The status element says whether we have yet output
+   the definition of the type.  TYPE_XREF says we have
+   output it as a cross-reference only.
+   The file_number and type_number elements are used if DBX_USE_BINCL
+   is defined.  */
+
+struct typeinfo GTY(())
+{
+  enum typestatus status;
+  int file_number;
+  int type_number;
+};
+
+/* Vector recording information about C data types.
+   When we first notice a data type (a tree node),
+   we assign it a number using next_type_number.
+   That is its index in this vector.  */
+
+static GTY ((length ("typevec_len"))) struct typeinfo *typevec;
+
+/* Number of elements of space allocated in `typevec'.  */
+
+static GTY(()) int typevec_len;
+
+/* In dbx output, each type gets a unique number.
+   This is the number for the next type output.
+   The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field.  */
+
+static GTY(()) int next_type_number;
+
+/* When using N_BINCL in dbx output, each type number is actually a
+   pair of the file number and the type number within the file.
+   This is a stack of input files.  */
+
+struct dbx_file GTY(())
+{
+  struct dbx_file *next;
+  int file_number;
+  int next_type_number;
+};
+
+/* This is the top of the stack.  */
+
+static GTY(()) struct dbx_file *current_file;
+
+/* This is the next file number to use.  */
+
+static GTY(()) int next_file_number;
+
 /* Typical USG systems don't have stab.h, and they also have
    no use for DBX-format debugging info.  */
 
 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
 
+/* Last source file name mentioned in a NOTE insn.  */
+
+static const char *lastfile;
+
+/* Current working directory.  */
+
+static const char *cwd;
+
 /* Nonzero if we have actually used any of the GDB extensions
    to the debugging format.  The idea is that we use them for the
    first time only if there's a strong reason, but once we have done that,
@@ -186,72 +248,6 @@ static int source_label_number = 1;
 
 static FILE *asmfile;
 
-/* Last source file name mentioned in a NOTE insn.  */
-
-static const char *lastfile;
-
-/* Current working directory.  */
-
-static const char *cwd;
-
-enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
-
-/* Structure recording information about a C data type.
-   The status element says whether we have yet output
-   the definition of the type.  TYPE_XREF says we have
-   output it as a cross-reference only.
-   The file_number and type_number elements are used if DBX_USE_BINCL
-   is defined.  */
-
-struct typeinfo
-{
-  enum typestatus status;
-#ifdef DBX_USE_BINCL
-  int file_number;
-  int type_number;
-#endif
-};
-
-/* Vector recording information about C data types.
-   When we first notice a data type (a tree node),
-   we assign it a number using next_type_number.
-   That is its index in this vector.  */
-
-struct typeinfo *typevec;
-
-/* Number of elements of space allocated in `typevec'.  */
-
-static int typevec_len;
-
-/* In dbx output, each type gets a unique number.
-   This is the number for the next type output.
-   The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field.  */
-
-static int next_type_number;
-
-#ifdef DBX_USE_BINCL
-
-/* When using N_BINCL in dbx output, each type number is actually a
-   pair of the file number and the type number within the file.
-   This is a stack of input files.  */
-
-struct dbx_file
-{
-  struct dbx_file *next;
-  int file_number;
-  int next_type_number;
-};
-
-/* This is the top of the stack.  */
-
-static struct dbx_file *current_file;
-
-/* This is the next file number to use.  */
-
-static int next_file_number;
-
-#endif /* DBX_USE_BINCL */
-
 /* These variables are for dbxout_symbol to communicate to
    dbxout_finish_symbol.
    current_sym_code is the symbol-type-code, a symbol N_... define in stab.h.
@@ -393,7 +389,7 @@ dbxout_function_end ()
      the system doesn't insert underscores in front of user generated
      labels.  */
   ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
-  ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Lscope", scope_labelno);
+  (*targetm.asm_out.internal_label) (asmfile, "Lscope", scope_labelno);
   scope_labelno++;
 
   /* By convention, GCC will mark the end of a function with an N_FUN
@@ -423,7 +419,7 @@ dbxout_init (input_file_name)
   asmfile = asm_out_file;
 
   typevec_len = 100;
-  typevec = (struct typeinfo *) xcalloc (typevec_len, sizeof typevec[0]);
+  typevec = (struct typeinfo *) ggc_calloc (typevec_len, sizeof typevec[0]);
 
   /* Convert Ltext into the appropriate format for local labels in case
      the system doesn't insert underscores in front of user generated
@@ -466,7 +462,7 @@ dbxout_init (input_file_name)
   assemble_name (asmfile, ltext_label_name);
   fputc ('\n', asmfile);
   text_section ();
-  ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0);
+  (*targetm.asm_out.internal_label) (asmfile, "Ltext", 0);
 #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
 
 #ifdef DBX_OUTPUT_GCC_MARKER
@@ -482,7 +478,7 @@ dbxout_init (input_file_name)
   next_type_number = 1;
 
 #ifdef DBX_USE_BINCL
-  current_file = (struct dbx_file *) xmalloc (sizeof *current_file);
+  current_file = (struct dbx_file *) ggc_alloc (sizeof *current_file);
   current_file->next = NULL;
   current_file->file_number = 0;
   current_file->next_type_number = 1;
@@ -539,7 +535,7 @@ dbxout_start_source_file (line, filename)
      const char *filename ATTRIBUTE_UNUSED;
 {
 #ifdef DBX_USE_BINCL
-  struct dbx_file *n = (struct dbx_file *) xmalloc (sizeof *n);
+  struct dbx_file *n = (struct dbx_file *) ggc_alloc (sizeof *n);
 
   n->next = current_file;
   n->file_number = next_file_number++;
@@ -558,12 +554,8 @@ dbxout_end_source_file (line)
      unsigned int line ATTRIBUTE_UNUSED;
 {
 #ifdef DBX_USE_BINCL
-  struct dbx_file *next;
-
   fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL);
-  next = current_file->next;
-  free (current_file);
-  current_file = next;
+  current_file = current_file->next;
 #endif
 }
 
@@ -594,7 +586,7 @@ dbxout_source_file (file, filename)
        ; /* Don't change section amid function.  */
       else
        text_section ();
-      ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", source_label_number);
+      (*targetm.asm_out.internal_label) (file, "Ltext", source_label_number);
       source_label_number++;
 #endif
       lastfile = filename;
@@ -625,7 +617,7 @@ dbxout_begin_block (line, n)
      unsigned int line ATTRIBUTE_UNUSED;
      unsigned int n;
 {
-  ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBB", n);
+  (*targetm.asm_out.internal_label) (asmfile, "LBB", n);
 }
 
 /* Describe the end line-number of an internal block within a function.  */
@@ -635,7 +627,7 @@ dbxout_end_block (line, n)
      unsigned int line ATTRIBUTE_UNUSED;
      unsigned int n;
 {
-  ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBE", n);
+  (*targetm.asm_out.internal_label) (asmfile, "LBE", n);
 }
 
 /* Output dbx data for a function definition.
@@ -1147,8 +1139,9 @@ dbxout_type (type, full)
       if (next_type_number == typevec_len)
        {
          typevec
-           = (struct typeinfo *) xrealloc (typevec,
-                                           typevec_len * 2 * sizeof typevec[0]);
+           = (struct typeinfo *) ggc_realloc (typevec,
+                                              (typevec_len * 2 
+                                               * sizeof typevec[0]));
          memset ((char *) (typevec + typevec_len), 0,
                 typevec_len * sizeof typevec[0]);
          typevec_len *= 2;
@@ -3006,3 +2999,5 @@ dbxout_begin_function (decl)
 #endif /* DBX_DEBUGGING_INFO */
 
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
+
+#include "gt-dbxout.h"