]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: introduce a "gcc/diagnostics" subdirectory
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 25 Jul 2025 19:13:34 +0000 (15:13 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 25 Jul 2025 19:13:34 +0000 (15:13 -0400)
The "gcc" subdirectory of our source tree currently contains a total
of almost 1000 .cc and .h files, enough to hit rate-limiting in some
git web UIs, and obscuring the logical relationships between subsystems.

In r16-2211-ga5d9debedd2f46 I started introducing a
"namespace diagnostics" so it makes sense to move such code
into a new "gcc/diagnostics" subdirectory.

My intent is for the "diagnostics" namespace/directory to contain
shared parts of the diagnostics code that are in libcommon, in
particular which don't have knowledge of trees.

This patch begins moving of the existing code within
"namespace diagnostics" into a new "gcc/diagnostics" subdirectory.

No functional change intended.

  renamed:    gcc/diagnostic-digraphs.cc -> gcc/diagnostics/digraphs.cc
  renamed:    gcc/diagnostic-digraphs.h -> gcc/diagnostics/digraphs.h
  renamed:    gcc/diagnostic-state-to-dot.cc -> gcc/diagnostics/state-graphs-to-dot.cc
  renamed:    gcc/diagnostic-state-graphs.cc -> gcc/diagnostics/state-graphs.cc
  renamed:    gcc/diagnostic-state-graphs.h -> gcc/diagnostics/state-graphs.h

contrib/ChangeLog:
* gcc.doxy (INPUT): Add gcc/diagnostics subdir.

gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Rename diagnostic-digraphs.o to
diagnostics/digraphs.o.  Rename diagnostic-state-graphs.o to
diagnostics/state-graphs.o.  Rename diagnostic-state-to-dot.o to
diagnostics/state-graphs-to-dot.o.
(PLUGIN_HEADERS): Add $(srcdir)/diagnostics/*.h.
(install-plugin:): Likewise.
* configure: Regenerate.
* configure.ac (gccdepdir): Add "diagnostics" to directories.
* diagnostic-format-html.cc: Update #includes for move of
"diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of
move of "diagnostic-state-graphs.h" to
"diagnostics/state-graphs.h".
* diagnostic-format-sarif.cc: Likewise.
* diagnostic-path.cc: Likewise for state-graphs.h
* diagnostic-digraphs.cc: Move...
* diagnostics/digraphs.cc: ...to here.  Update #include
for renaming of digraphs.h.
(selftest::diagnostic_digraphs_cc_tests): Rename to...
(selftest::diagnostics_digraphs_cc_tests): ...this.
* diagnostic-digraphs.h: Move...
* diagnostics/digraphs.h: ...to here, updating header guard.
* diagnostic-state-to-dot.cc: Move...
* diagnostics/state-graphs-to-dot.cc: ...to here.  Update #include
of state-graphs.h.
* diagnostic-state-graphs.cc: Move...
* diagnostics/state-graphs.cc: ...to here.  Update #include
of state-graphs.h.
(selftest::diagnostic_state_graphs_cc_tests): Rename...
(selftest::diagnostics_state_graphs_cc_tests): ...to this.
* diagnostic-state-graphs.h: Move...
* diagnostics/state-graphs.h: ...to here, updating header guard.
* libgdiagnostics.cc: Update #includes for move of
"diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of
move of "diagnostic-state-graphs.h" to
"diagnostics/state-graphs.h".
* selftest-run-tests.cc (selftest::run_tests): Update for
function renamings that reflect file renamings.
* selftest.h (selftest::diagnostic_digraphs_cc_tests): Rename
to...
(selftest::diagnostics_digraphs_cc_tests): ...this.
(selftest::diagnostic_state_graphs_cc_tests): Rename...
(selftest::diagnostics_state_graphs_cc_tests): ...to this.

gcc/analyzer/ChangeLog:
* ana-state-to-diagnostic-state.cc: Update #include for move of
"diagnostic-state-graphs.h" to "diagnostics/state-graphs.h".
* ana-state-to-diagnostic-state.h: Likewise.
* checker-event.cc: Likewise.
* checker-event.h: Update #include for move of
"diagnostic-digraphs.h" to "diagnostics/digraphs.h".
* program-state.cc: : Update #include for move of
"diagnostic-state-graphs.h" to "diagnostics/state-graphs.h".

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Update #include
for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h".

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
21 files changed:
contrib/gcc.doxy
gcc/Makefile.in
gcc/analyzer/ana-state-to-diagnostic-state.cc
gcc/analyzer/ana-state-to-diagnostic-state.h
gcc/analyzer/checker-event.cc
gcc/analyzer/checker-event.h
gcc/analyzer/program-state.cc
gcc/configure
gcc/configure.ac
gcc/diagnostic-format-html.cc
gcc/diagnostic-format-sarif.cc
gcc/diagnostic-path.cc
gcc/diagnostics/digraphs.cc [moved from gcc/diagnostic-digraphs.cc with 99% similarity]
gcc/diagnostics/digraphs.h [moved from gcc/diagnostic-digraphs.h with 98% similarity]
gcc/diagnostics/state-graphs-to-dot.cc [moved from gcc/diagnostic-state-to-dot.cc with 99% similarity]
gcc/diagnostics/state-graphs.cc [moved from gcc/diagnostic-state-graphs.cc with 98% similarity]
gcc/diagnostics/state-graphs.h [moved from gcc/diagnostic-state-graphs.h with 96% similarity]
gcc/libgdiagnostics.cc
gcc/selftest-run-tests.cc
gcc/selftest.h
gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc

index cf3281fe0f46078741af45e43a45b797cb2546d6..15952046f25658c2363698f1ee57c4c5d31ea48f 100644 (file)
@@ -478,7 +478,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = gcc gcc/analyzer gcc/text-art
+INPUT                  = gcc gcc/analyzer gcc/diagnostics gcc/text-art
 
 # This tag can be used to specify the character encoding of the source files that 
 # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default 
index 05dfa0871be2a493fc0cb88e00530a61edafc377..7391a18a351d2bdf7775b5eaee25ace89de89bff 100644 (file)
@@ -1857,14 +1857,14 @@ OBJS-libcommon = diagnostic-spec.o diagnostic.o diagnostic-color.o \
        diagnostic-format-sarif.o \
        diagnostic-format-text.o \
        diagnostic-global-context.o \
-       diagnostic-digraphs.o \
        diagnostic-macro-unwinding.o \
        diagnostic-output-spec.o \
        diagnostic-path.o \
        diagnostic-path-output.o \
        diagnostic-show-locus.o \
-       diagnostic-state-graphs.o \
-       diagnostic-state-to-dot.o \
+       diagnostics/digraphs.o \
+       diagnostics/state-graphs.o \
+       diagnostics/state-graphs-to-dot.o \
        edit-context.o \
        graphviz.o pex.o \
        pretty-print.o intl.o \
@@ -4082,7 +4082,7 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   hash-set.h dominance.h cfg.h cfgrtl.h cfganal.h cfgbuild.h cfgcleanup.h \
   lcm.h cfgloopmanip.h file-prefix-map.h builtins.def $(INSN_ATTR_H) \
   pass-instances.def params.list $(srcdir)/../include/gomp-constants.h \
-  $(EXPR_H) $(srcdir)/analyzer/*.h
+  $(EXPR_H) $(srcdir)/analyzer/*.h $(srcdir)/diagnostics/*.h
 
 # generate the 'build fragment' b-header-vars
 s-header-vars: Makefile
@@ -4120,6 +4120,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
          fi; \
          case $$path in \
          "$(srcdir)"/analyzer/* \
+         | "$(srcdir)"/diagnostics/* \
          | "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
          | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
            base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
index 27012595c8ae55b484d6afd0d81acb61de72940c..2604e09883d5f9c1e5fc23ce77643eda33e4e091 100644 (file)
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 #define INCLUDE_SET
 #include "analyzer/common.h"
 
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 #include "diagnostic-format-sarif.h"
 
 #include "analyzer/region-model.h"
index 186e19d2f51e21f5e5938c788486c17baea07406..3a5ccc1b4306b27984e0a0e8366134ab82e18a3f 100644 (file)
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_ANALYZER_ANA_STATE_TO_DIAGNOSTIC_STATE_H
 #define GCC_ANALYZER_ANA_STATE_TO_DIAGNOSTIC_STATE_H
 
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 #include "tree-logical-location.h"
 
 namespace ana {
index 8cc5ac2b1da3dc1d5f254a7bfab4c80cb2a78502..665bb0d509edc1693b272455a76e8112fa140599 100644 (file)
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "inlining-iterator.h"
 #include "tree-logical-location.h"
 #include "diagnostic-format-sarif.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 
 #include "analyzer/analyzer-logging.h"
 #include "analyzer/sm.h"
index cf24e777e29aeaf7cddd8fd9cddc1e6f8ff0b29b..d3b64e33a1937a21382ee3fac89b04796a038e12 100644 (file)
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-logical-location.h"
 #include "analyzer/program-state.h"
 #include "analyzer/event-loc-info.h"
-#include "diagnostic-digraphs.h"
+#include "diagnostics/digraphs.h"
 
 namespace ana {
 
index 85cbe759ee91d92ae9b71c2be89493c06d1cb625..ea64bdd9ffb7ca15627726937553d3b0b7ee46a9 100644 (file)
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "digraph.h"
 #include "diagnostic-event-id.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 #include "graphviz.h"
 
 #include "text-art/tree-widget.h"
index 7537da20291ac65ae75620e43f85a32c4a9b5ab6..bacdd29da69a8bd88b99d7a2088424359b8ebf67 100755 (executable)
@@ -36498,7 +36498,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
     "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;;
     "gccdepdir":C)
   ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
-  for lang in $subdirs c-family common analyzer text-art rtl-ssa sym-exec
+  for lang in $subdirs c-family common analyzer diagnostics text-art rtl-ssa sym-exec
   do
       ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
   done ;;
index 24e0aa69c0f6f8775188393a4989139d8cb5ca9e..2c43b38178c74578a5d61119783894075e560fad 100644 (file)
@@ -1397,7 +1397,7 @@ AC_CHECK_HEADERS(ext/hash_map)
 ZW_CREATE_DEPDIR
 AC_CONFIG_COMMANDS([gccdepdir],[
   ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
-  for lang in $subdirs c-family common analyzer text-art rtl-ssa sym-exec
+  for lang in $subdirs c-family common analyzer diagnostics text-art rtl-ssa sym-exec
   do
       ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
   done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
index becac39f5dcca1b4b3665a30755d786cdb484a71..bac99260ec336cb255ebb2dd189df34b814bc653 100644 (file)
@@ -42,8 +42,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "intl.h"
 #include "xml.h"
 #include "xml-printer.h"
-#include "diagnostic-digraphs.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/digraphs.h"
+#include "diagnostics/state-graphs.h"
 #include "graphviz.h"
 #include "json.h"
 #include "selftest-xml.h"
index d20ca86ae752c663672f127a7c08dfc4d9e3027d..dd8b07939402787a34d32bd3b9fa6e391e101e6d 100644 (file)
@@ -28,8 +28,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic.h"
 #include "diagnostic-metadata.h"
-#include "diagnostic-digraphs.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/digraphs.h"
+#include "diagnostics/state-graphs.h"
 #include "diagnostic-path.h"
 #include "diagnostic-format.h"
 #include "diagnostic-buffer.h"
index 1ae87b7e0bce14327c211d24f95b9b3d211b5d64..e55a11cb54e9f8ccde5db824de0eaf0d0235cc52 100644 (file)
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic.h"
 #include "diagnostic-path.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 
 /* Disable warnings about missing quoting in GCC diagnostics for the print
    calls below.  */
similarity index 99%
rename from gcc/diagnostic-digraphs.cc
rename to gcc/diagnostics/digraphs.cc
index 85c0c5166c0a40f4cac7451ae21bf056201c93c7..5571c007802d72bc7f1153b7f590bcf441fd4902 100644 (file)
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 
 #include "graphviz.h"
-#include "diagnostic-digraphs.h"
+#include "diagnostics/digraphs.h"
 #include "diagnostic-format-sarif.h"
 
 #include "selftest.h"
@@ -473,7 +473,7 @@ test_simple_graph ()
 /* Run all of the selftests within this file.  */
 
 void
-diagnostic_digraphs_cc_tests ()
+diagnostics_digraphs_cc_tests ()
 {
   test_empty_graph ();
   test_simple_graph ();
similarity index 98%
rename from gcc/diagnostic-digraphs.h
rename to gcc/diagnostics/digraphs.h
index d6f8e7e11ac491efec3e8a0ee1a3b108b93ae37e..5c07fa866c9001935997225affdf1e77aa3b3d6b 100644 (file)
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#ifndef GCC_DIAGNOSTIC_DIGRAPHS_H
-#define GCC_DIAGNOSTIC_DIGRAPHS_H
+#ifndef GCC_DIAGNOSTICS_DIGRAPHS_H
+#define GCC_DIAGNOSTICS_DIGRAPHS_H
 
 #include "json.h"
 #include "logical-location.h"
@@ -418,4 +418,4 @@ private:
 } // namespace digraphs
 } // namespace diagnostics
 
-#endif /* ! GCC_DIAGNOSTIC_DIGRAPHS_H */
+#endif /* ! GCC_DIAGNOSTICS_DIGRAPHS_H */
similarity index 99%
rename from gcc/diagnostic-state-to-dot.cc
rename to gcc/diagnostics/state-graphs-to-dot.cc
index 90ceaee756e3ae83133e3266c2ad8de73c7a2d92..9b64fa0889f01ad441a466972355f22d99243a9f 100644 (file)
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 #include "graphviz.h"
 #include "xml.h"
 #include "xml-printer.h"
similarity index 98%
rename from gcc/diagnostic-state-graphs.cc
rename to gcc/diagnostics/state-graphs.cc
index 62eb6f5704a37d95dddc51d1f6bf5721be93a16b..e2c8c1d33cf75cf25bbc6c2cc6a46f52d28b5b98 100644 (file)
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/state-graphs.h"
 #include "graphviz.h"
 #include "xml.h"
 #include "xml-printer.h"
@@ -148,7 +148,7 @@ test_node_attrs ()
 /* Run all of the selftests within this file.  */
 
 void
-diagnostic_state_graphs_cc_tests ()
+diagnostics_state_graphs_cc_tests ()
 {
   test_node_attrs ();
 }
similarity index 96%
rename from gcc/diagnostic-state-graphs.h
rename to gcc/diagnostics/state-graphs.h
index def6d05889710b49266256c05c4334eaa343f893..ccf8bde821ab716003fb365578c2756658013b6c 100644 (file)
@@ -18,10 +18,10 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#ifndef GCC_DIAGNOSTIC_STATE_GRAPHS_H
-#define GCC_DIAGNOSTIC_STATE_GRAPHS_H
+#ifndef GCC_DIAGNOSTICS_STATE_GRAPHS_H
+#define GCC_DIAGNOSTICS_STATE_GRAPHS_H
 
-#include "diagnostic-digraphs.h"
+#include "diagnostics/digraphs.h"
 #include "logical-location.h"
 
 /* diagnostics::digraphs provides support for directed graphs.
@@ -153,4 +153,4 @@ make_dot_graph (const diagnostics::digraphs::digraph &state_graph,
 } // namespace state_graphs
 } // namespace diagnostics
 
-#endif /* ! GCC_DIAGNOSTIC_STATE_GRAPHS_H */
+#endif /* ! GCC_DIAGNOSTICS_STATE_GRAPHS_H */
index 172f19c59bd62f5eb56a1188010cc3f694793ebc..7bf0cbd7f4b8e834a37560ba9db8d37efe74a351 100644 (file)
@@ -33,8 +33,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-format-sarif.h"
 #include "diagnostic-format-text.h"
 #include "diagnostic-output-spec.h"
-#include "diagnostic-digraphs.h"
-#include "diagnostic-state-graphs.h"
+#include "diagnostics/digraphs.h"
+#include "diagnostics/state-graphs.h"
 #include "logical-location.h"
 #include "edit-context.h"
 #include "libgdiagnostics.h"
index d43d9dd65131cdcd4442c3937e1d5ce6ae31e932..8cd04149f1ae9fb30794597e51e31de222c8ee2a 100644 (file)
@@ -102,9 +102,9 @@ selftest::run_tests ()
   diagnostic_show_locus_cc_tests ();
   diagnostic_format_html_cc_tests ();
   diagnostic_format_sarif_cc_tests ();
-  diagnostic_digraphs_cc_tests ();
+  diagnostics_digraphs_cc_tests ();
   diagnostic_output_spec_cc_tests ();
-  diagnostic_state_graphs_cc_tests ();
+  diagnostics_state_graphs_cc_tests ();
   edit_context_cc_tests ();
   fold_const_cc_tests ();
   spellcheck_cc_tests ();
index 06485e1fffafc823e01fdf9c02405d281f5fb5b0..5b1d2b00ad89e08cd59a5fb0564d38ebf644d2c1 100644 (file)
@@ -222,13 +222,13 @@ extern void cgraph_cc_tests ();
 extern void convert_cc_tests ();
 extern void dbgcnt_cc_tests ();
 extern void diagnostic_color_cc_tests ();
-extern void diagnostic_digraphs_cc_tests ();
 extern void diagnostic_format_html_cc_tests ();
 extern void diagnostic_format_sarif_cc_tests ();
 extern void diagnostic_output_spec_cc_tests ();
 extern void diagnostic_path_output_cc_tests ();
 extern void diagnostic_show_locus_cc_tests ();
-extern void diagnostic_state_graphs_cc_tests ();
+extern void diagnostics_digraphs_cc_tests ();
+extern void diagnostics_state_graphs_cc_tests ();
 extern void digraph_cc_tests ();
 extern void dumpfile_cc_tests ();
 extern void edit_context_cc_tests ();
index d43216170631a81696ee54ec606f15f5c3b44599..cfaffbf346178b40fae54bc58c8ee4f839f243c1 100644 (file)
@@ -34,7 +34,7 @@
 #include "context.h"
 #include "gcc-rich-location.h"
 #include "diagnostic-metadata.h"
-#include "diagnostic-digraphs.h"
+#include "diagnostics/digraphs.h"
 #include "pass_manager.h"