After changes by Sharad (Add option for dumping to stderr (issue6190057)),
-fdump-ada-spec is broken, and is now a no-op.

Admittedly, this is because -fdump-ada-spec is handled differently from
other -fdump-* switches, so this patch fixes support for -fdump-ada-spec
by using an approach similar to -fdump-go-spec, and use regular switches
via c/c.opt. I've removed the handling of TDF_RAW, which was a debugging
option, and never really used, so can be simply deleted.

Change is mostly trivial/mechanical.

Tested on x86_64-pc-linux-gnu, OK for trunk?

gcc/

2012-10-04  Arnaud Charlet  <char...@adacore.com>

        * dumpfile.h, dumpfile.c: Remove TDI_ada.

c-family/

2012-10-04  Arnaud Charlet  <char...@adacore.com>

        * c-ada-spec.c (print_ada_declaration): Remove handling of TDF_RAW.
        * c.opt (-fdump-ada-spec, -fdump-ada-spec-slim): Move switch definition
        out of dumpfile.h.

c/

2012-10-04  Arnaud Charlet  <char...@adacore.com>

        * c-decl.c (c_write_global_declarations): Fix handling of
        -fdump-ada-spec*.

cp/

2012-10-04  Arnaud Charlet  <char...@adacore.com>
        
        * decl2.c (cp_write_global_declarations): Fix handling of
        -fdump-ada-spec*.

Arno
--
Index: c-family/c.opt
===================================================================
--- c-family/c.opt      (revision 192062)
+++ c-family/c.opt      (working copy)
@@ -799,6 +799,14 @@ fdollars-in-identifiers
 C ObjC C++ ObjC++
 Permit '$' as an identifier character
 
+fdump-ada-spec
+C ObjC C++ ObjC++ RejectNegative Var(flag_dump_ada_spec)
+Write all declarations as Ada code transitively
+
+fdump-ada-spec-slim
+C ObjC C++ ObjC++ RejectNegative Var(flag_dump_ada_spec_slim)
+Write all declarations as Ada code for the given file only
+
 felide-constructors
 C++ ObjC++ Var(flag_elide_constructors) Init(1)
 
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c       (revision 192062)
+++ c-family/c-ada-spec.c       (working copy)
@@ -2535,7 +2535,6 @@ print_ada_declaration (pretty_printer *b
   int is_class = false;
   tree name = TYPE_NAME (TREE_TYPE (t));
   tree decl_name = DECL_NAME (t);
-  bool dump_internal = get_dump_file_info (TDI_ada)->pflags & TDF_RAW;
   tree orig = NULL_TREE;
 
   if (cpp_check && cpp_check (t, IS_TEMPLATE))
@@ -2705,8 +2704,7 @@ print_ada_declaration (pretty_printer *b
     }
   else
     {
-      if (!dump_internal
-         && TREE_CODE (t) == VAR_DECL
+      if (TREE_CODE (t) == VAR_DECL
          && decl_name
          && *IDENTIFIER_POINTER (decl_name) == '_')
        return 0;
@@ -2796,8 +2794,7 @@ print_ada_declaration (pretty_printer *b
 
       /* If this function has an entry in the dispatch table, we cannot
         omit it.  */
-      if (!dump_internal && !DECL_VINDEX (t)
-         && *IDENTIFIER_POINTER (decl_name) == '_')
+      if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_')
        {
          if (IDENTIFIER_POINTER (decl_name)[1] == '_')
            return 0;
Index: c/c-decl.c
===================================================================
--- c/c-decl.c  (revision 192062)
+++ c/c-decl.c  (working copy)
@@ -10079,10 +10079,10 @@ c_write_global_declarations (void)
   gcc_assert (!current_scope);
 
   /* Handle -fdump-ada-spec[-slim]. */
-  if (dump_initialized_p (TDI_ada))
+  if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
     {
       /* Build a table of files to generate specs for */
-      if (get_dump_file_info (TDI_ada)->pflags & TDF_SLIM)
+      if (flag_dump_ada_spec_slim)
        collect_source_ref (main_input_filename);
       else
        for_each_global_decl (collect_source_ref_cb);
Index: cp/decl2.c
===================================================================
--- cp/decl2.c  (revision 192062)
+++ cp/decl2.c  (working copy)
@@ -3698,9 +3698,9 @@ cp_write_global_declarations (void)
   cgraph_process_same_body_aliases ();
 
   /* Handle -fdump-ada-spec[-slim] */
-  if (dump_initialized_p (TDI_ada))
+  if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
     {
-      if (get_dump_file_info (TDI_ada)->pflags & TDF_SLIM)
+      if (flag_dump_ada_spec_slim)
        collect_source_ref (main_input_filename);
       else
        collect_source_refs (global_namespace);
Index: dumpfile.c
===================================================================
--- dumpfile.c  (revision 192062)
+++ dumpfile.c  (working copy)
@@ -57,8 +57,7 @@ static struct dump_file_info dump_files[
    0, 0, 0, 5},
   {".vcg", "tree-vcg", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 6},
-  {".ads", "ada-spec", NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 7},
-#define FIRST_AUTO_NUMBERED_DUMP 8
+#define FIRST_AUTO_NUMBERED_DUMP 7
 
   {NULL, "tree-all", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0},
Index: dumpfile.h
===================================================================
--- dumpfile.h  (revision 192062)
+++ dumpfile.h  (working copy)
@@ -37,7 +37,6 @@ enum tree_dump_index
   TDI_nested,                  /* dump each function after unnesting it */
   TDI_vcg,                     /* create a VCG graph file for each
                                   function's flowgraph.  */
-  TDI_ada,                      /* dump declarations in Ada syntax.  */
   TDI_tree_all,                 /* enable all the GENERIC/GIMPLE dumps.  */
   TDI_rtl_all,                  /* enable all the RTL dumps.  */
   TDI_ipa_all,                  /* enable all the IPA dumps.  */

Reply via email to