c-ada-spec.h (decl_sloc): Delete.
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 20 Dec 2019 17:41:06 +0000 (17:41 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 20 Dec 2019 17:41:06 +0000 (17:41 +0000)
c-family/
* c-ada-spec.h (decl_sloc): Delete.
* c-ada-spec.c (decl_sloc): Make static.
c/
* c-decl.c (collect_source_ref_cb): Delete.
(for_each_global_decl): Rename into...
(collect_source_refs): ...this.  Call collect_source_ref directly.
(c_parse_final_cleanups): Always call collect_source_ref on the main
input filename.
cp/
* decl2.c (c_parse_final_cleanups): Always call collect_source_ref on
the main input filename.

From-SVN: r279670

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c
gcc/c-family/c-ada-spec.h
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/cp/ChangeLog
gcc/cp/decl2.c

index 30cbc133dc391f0a872c13997b34235f065a4c86..33ea8ab53d68ada7282c58649ec966f600617d7f 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.h (decl_sloc): Delete.
+       * c-ada-spec.c (decl_sloc): Make static.
+
 2019-12-19  Julian Brown  <julian@codesourcery.com>
 
        * c-common.h (c_omp_map_clause_name): Add prototype.
index 5a142ce91be87bde9cc7ee79efe5f672ca37cacd..024a3ac91713b6451f751d5087b6aae7a0c5db70 100644 (file)
@@ -630,7 +630,7 @@ static const char *current_source_file;
 
 /* Return sloc of DECL, using sloc of last field if LAST is true.  */
 
-location_t
+static location_t
 decl_sloc (const_tree decl, bool last)
 {
   tree field;
index f9ea1bcc698f7a4f3a5ac87e7fe173fc07845454..085e89120b206143a88b66bf0b9ae364ddf4837d 100644 (file)
@@ -36,7 +36,6 @@ enum cpp_operation {
   IS_TRIVIAL
 };
 
-extern location_t decl_sloc (const_tree, bool);
 extern void collect_ada_nodes (tree, const char *);
 extern void collect_source_ref (const char *);
 extern void dump_ada_specs (void (*)(const char *),
index 469dc5d5d3483a246622f28d9ee76985e1f5fbcf..86b6c9fc6ab3cf5efd0e2a695ac6b2e816e3059b 100644 (file)
@@ -1,3 +1,11 @@
+2019-12-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-decl.c (collect_source_ref_cb): Delete.
+       (for_each_global_decl): Rename into...
+       (collect_source_refs): ...this.  Call collect_source_ref directly.
+       (c_parse_final_cleanups): Always call collect_source_ref on the main
+       input filename.
+
 2019-12-19  Julian Brown  <julian@codesourcery.com>
            Cesar Philippidis  <cesar@codesourcery.com>
 
index 0450fcd3514f1e5c224424cf4a1748b6dcfba005..01f85e2feba4c917e7510dc9b662808150837583 100644 (file)
@@ -11787,15 +11787,6 @@ c_write_global_declarations_1 (tree globals)
   while (reconsider);
 }
 
-/* Callback to collect a source_ref from a DECL.  */
-
-static void
-collect_source_ref_cb (tree decl)
-{
-  if (!DECL_IS_BUILTIN (decl))
-    collect_source_ref (LOCATION_FILE (decl_sloc (decl, false)));
-}
-
 /* Preserve the external declarations scope across a garbage collect.  */
 static GTY(()) tree ext_block;
 
@@ -11813,10 +11804,10 @@ collect_all_refs (const char *source_file)
   collect_ada_nodes (BLOCK_VARS (ext_block), source_file);
 }
 
-/* Iterate over all global declarations and call CALLBACK.  */
+/* Collect source file references at global level.  */
 
 static void
-for_each_global_decl (void (*callback) (tree decl))
+collect_source_refs (void)
 {
   tree t;
   tree decls;
@@ -11827,11 +11818,13 @@ for_each_global_decl (void (*callback) (tree decl))
     { 
       decls = DECL_INITIAL (t);
       for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
-       callback (decl);
+       if (!DECL_IS_BUILTIN (decl))
+         collect_source_ref (DECL_SOURCE_FILE (decl));
     }
 
   for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
-    callback (decl);
+    if (!DECL_IS_BUILTIN (decl))
+      collect_source_ref (DECL_SOURCE_FILE (decl));
 }
 
 /* Perform any final parser cleanups and generate initial debugging
@@ -11865,10 +11858,9 @@ c_parse_final_cleanups (void)
   if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
     {
       /* Build a table of files to generate specs for */
-      if (flag_dump_ada_spec_slim)
-       collect_source_ref (main_input_filename);
-      else
-       for_each_global_decl (collect_source_ref_cb);
+      collect_source_ref (main_input_filename);
+      if (!flag_dump_ada_spec_slim)
+       collect_source_refs ();
 
       dump_ada_specs (collect_all_refs, NULL);
     }
index 2b90d0ca7cfd9887b1a47f8bc0516941867dc713..37353e91b036880f47f53ab60909d6d061d795fe 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on
+       the main input filename.
+
 2019-12-19  Julian Brown  <julian@codesourcery.com>
            Cesar Philippidis  <cesar@codesourcery.com>
 
index 0352954b817ad19f14aaf7f5b06c81db8d0eafe5..6ff81136c5817bc481e66e03d20f2b313d8e4d93 100644 (file)
@@ -4816,9 +4816,8 @@ c_parse_final_cleanups (void)
   /* Handle -fdump-ada-spec[-slim] */
   if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
     {
-      if (flag_dump_ada_spec_slim)
-       collect_source_ref (main_input_filename);
-      else
+      collect_source_ref (main_input_filename);
+      if (!flag_dump_ada_spec_slim)
        collect_source_refs (global_namespace);
 
       dump_ada_specs (collect_all_refs, cpp_check);