From: David Malcolm Date: Fri, 25 Jul 2025 19:13:38 +0000 (-0400) Subject: diagnostics: move diagnostic-macro-unwinding.{cc,h} -> diagnostics/macro-unwinding... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3565f244f462826469c086d0152b6e4cbd60488;p=thirdparty%2Fgcc.git diagnostics: move diagnostic-macro-unwinding.{cc,h} -> diagnostics/macro-unwinding.{cc,h} gcc/ChangeLog: * Makefile.in (OBJS): Replace diagnostic-macro-unwinding.o with diagnostics/macro-unwinding.o. * diagnostic-macro-unwinding.cc: Move to... * diagnostics/macro-unwinding.cc: ...here, moving content into namespace diagnostics. * diagnostic-macro-unwinding.h: Move to... * diagnostics/macro-unwinding.h: ...here, moving content into namespace diagnostics. * diagnostics/paths-output.cc: Update for move of "diagnostic-macro-unwinding.h" to "diagnostics/macro-unwinding.h". gcc/c-family/ChangeLog: * c-opts.cc: Update for move of "diagnostic-macro-unwinding.h" to "diagnostics/macro-unwinding.h". Signed-off-by: David Malcolm --- diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6289dcae8f2..a7c184ceae0 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1854,13 +1854,13 @@ OBJS = \ # no target dependencies. OBJS-libcommon = diagnostic-spec.o diagnostic.o diagnostic-color.o \ diagnostic-global-context.o \ - diagnostic-macro-unwinding.o \ diagnostics/digraphs.o \ diagnostics/edit-context.o \ diagnostics/output-spec.o \ diagnostics/html-sink.o \ diagnostics/sarif-sink.o \ diagnostics/text-sink.o \ + diagnostics/macro-unwinding.o \ diagnostics/paths.o \ diagnostics/paths-output.o \ diagnostics/source-printing.o \ diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index a211992e1b5..96130d71afd 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "toplev.h" #include "langhooks.h" -#include "diagnostic-macro-unwinding.h" /* for virt_loc_aware_diagnostic_finalizer */ +#include "diagnostics/macro-unwinding.h" /* for virt_loc_aware_diagnostic_finalizer */ #include "intl.h" #include "cppdefault.h" #include "incpath.h" @@ -182,7 +182,7 @@ c_diagnostic_text_finalizer (diagnostics::text_sink &text_output, diagnostic->richloc, diagnostic->kind, pp); /* By default print macro expansion contexts in the diagnostic finalizer -- for tokens resulting from macro expansion. */ - virt_loc_aware_diagnostic_finalizer (text_output, diagnostic); + diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic); pp_set_prefix (pp, saved_prefix); pp_flush (pp); } diff --git a/gcc/diagnostic-macro-unwinding.cc b/gcc/diagnostics/macro-unwinding.cc similarity index 96% rename from gcc/diagnostic-macro-unwinding.cc rename to gcc/diagnostics/macro-unwinding.cc index 76506068404..66bad1c32a7 100644 --- a/gcc/diagnostic-macro-unwinding.cc +++ b/gcc/diagnostics/macro-unwinding.cc @@ -22,10 +22,12 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "diagnostic.h" -#include "diagnostic-macro-unwinding.h" +#include "diagnostics/macro-unwinding.h" #include "diagnostics/text-sink.h" #include "intl.h" +namespace diagnostics { + /* This is a pair made of a location and the line map it originated from. It's used in the maybe_unwind_expanded_macro_loc function below. */ @@ -73,7 +75,7 @@ struct loc_map_pair function. */ void -maybe_unwind_expanded_macro_loc (diagnostics::text_sink &text_output, +maybe_unwind_expanded_macro_loc (text_sink &text_output, location_t where) { const struct line_map *map; @@ -215,8 +217,11 @@ maybe_unwind_expanded_macro_loc (diagnostics::text_sink &text_output, that is similar to what is done for function call stacks, or template instantiation contexts. */ void -virt_loc_aware_diagnostic_finalizer (diagnostics::text_sink &text_output, - const diagnostic_info *diagnostic) +virt_loc_aware_text_finalizer (text_sink &text_output, + const diagnostic_info *diagnostic) { - maybe_unwind_expanded_macro_loc (text_output, diagnostic_location (diagnostic)); + maybe_unwind_expanded_macro_loc (text_output, + diagnostic_location (diagnostic)); } + +} // namespace diagnostics diff --git a/gcc/diagnostic-macro-unwinding.h b/gcc/diagnostics/macro-unwinding.h similarity index 69% rename from gcc/diagnostic-macro-unwinding.h rename to gcc/diagnostics/macro-unwinding.h index b2173bcee25..1f28d584c25 100644 --- a/gcc/diagnostic-macro-unwinding.h +++ b/gcc/diagnostics/macro-unwinding.h @@ -17,13 +17,17 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ -#ifndef GCC_DIAGNOSTIC_MACRO_UNWINDING_H -#define GCC_DIAGNOSTIC_MACRO_UNWINDING_H +#ifndef GCC_DIAGNOSTICS_MACRO_UNWINDING_H +#define GCC_DIAGNOSTICS_MACRO_UNWINDING_H -void virt_loc_aware_diagnostic_finalizer (diagnostics::text_sink &, - const diagnostic_info *); +namespace diagnostics { -extern void maybe_unwind_expanded_macro_loc (diagnostics::text_sink &, +extern void virt_loc_aware_text_finalizer (text_sink &, + const diagnostic_info *); + +extern void maybe_unwind_expanded_macro_loc (text_sink &, location_t where); -#endif /* ! GCC_DIAGNOSTIC_MACRO_UNWINDING_H */ +} // namespace diagnostics + +#endif /* ! GCC_DIAGNOSTICS_MACRO_UNWINDING_H */ diff --git a/gcc/diagnostics/paths-output.cc b/gcc/diagnostics/paths-output.cc index 599d6849cfc..5cf61ceb10b 100644 --- a/gcc/diagnostics/paths-output.cc +++ b/gcc/diagnostics/paths-output.cc @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "diagnostic.h" -#include "diagnostic-macro-unwinding.h" +#include "diagnostics/macro-unwinding.h" #include "intl.h" #include "diagnostics/paths.h" #include "gcc-rich-location.h"