No functional change intended.
gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace diagnostic-output-spec.o
with diagnostics/output-spec.o.
* diagnostic-output-spec.cc: Move to...
* diagnostics/output-spec.cc: ...here. Update #include for
move of diagnostic-output-spec.h to diagnostics/output-spec.h.
(namespace::diagnostics_output_spec): Replace with...
(namespace diagnostics::output_spec): ...this, removing redundant
prefixes.
(diagnostics_output_spec::gcc_spec_context): Replace with...
(diagnostics::output_spec::dc_spec_context): ...this.
(diagnostic_output_spec_cc_tests): Rename to...
(diagnostics_output_spec_cc_tests): ...this.
* diagnostic-output-spec.h: Move to...
* diagnostics/output-spec.h: ...here and update inclusion guard.
(namespace::diagnostics_output_spec): Replace with...
(namespace diagnostics::output_spec): ...this, removing redundant
prefixes.
(diagnostics_output_spec::gcc_spec_context): Replace with...
(diagnostics::output_spec::dc_spec_context): ...this.
* libgdiagnostics.cc: Update #include for move of
diagnostic-output-spec.h to diagnostics/output-spec.h.
* opts-diagnostic.cc: Likewise. Update for namespace and name
changes.
* selftest-run-tests.cc (selftest::run_tests): Update for renaming
of diagnostic_output_spec_cc_tests to
diagnostics_output_spec_cc_tests.
* selftest.h (diagnostic_output_spec_cc_tests): Rename decl to...
(diagnostics_output_spec_cc_tests): ...this.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
diagnostic-format-text.o \
diagnostic-global-context.o \
diagnostic-macro-unwinding.o \
- diagnostic-output-spec.o \
diagnostic-path.o \
diagnostic-path-output.o \
diagnostic-show-locus.o \
diagnostics/digraphs.o \
diagnostics/edit-context.o \
+ diagnostics/output-spec.o \
diagnostics/state-graphs.o \
diagnostics/state-graphs-to-dot.o \
diagnostics/selftest-logical-locations.o \
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "pretty-print-markup.h"
-#include "diagnostic-output-spec.h"
+#include "diagnostics/output-spec.h"
/* A namespace for handling the DSL of the arguments of
-fdiagnostics-add-output= and -fdiagnostics-set-output=. */
-namespace diagnostics_output_spec {
+namespace diagnostics {
+namespace output_spec {
/* Decls. */
get_option_name (), scheme_name.c_str (), key.c_str (), metavar);
}
-diagnostics::output_file
+output_file
context::open_output_file (label_text &&filename) const
{
FILE *outf = fopen (filename.get (), "w");
if (!outf)
{
report_error ("unable to open %qs: %m", filename.get ());
- return diagnostics::output_file (nullptr, false, std::move (filename));
+ return output_file (nullptr, false, std::move (filename));
}
- return diagnostics::output_file (outf, true, std::move (filename));
+ return output_file (outf, true, std::move (filename));
}
static std::unique_ptr<scheme_name_and_params>
context::parse_and_make_sink (const char *unparsed_arg,
diagnostic_context &dc)
{
- auto parsed_arg = diagnostics_output_spec::parse (*this, unparsed_arg);
+ auto parsed_arg = parse (*this, unparsed_arg);
if (!parsed_arg)
return nullptr;
- diagnostics_output_spec::output_factory factory;
+ output_factory factory;
return factory.make_sink (*this, dc, unparsed_arg, *parsed_arg);
}
return nullptr;
}
- diagnostics::output_file output_file;
+ output_file output_file_;
if (filename.get ())
- output_file = ctxt.open_output_file (std::move (filename));
+ output_file_ = ctxt.open_output_file (std::move (filename));
else
// Default filename
{
"FILENAME");
return nullptr;
}
- output_file
+ output_file_
= diagnostic_output_format_open_sarif_file
(dc,
ctxt.get_affected_location_mgr (),
basename,
serialization_kind);
}
- if (!output_file)
+ if (!output_file_)
return nullptr;
auto sarif_gen_opts = make_sarif_gen_opts (version, state_graph);
*ctxt.get_affected_location_mgr (),
std::move (serialization_obj),
sarif_gen_opts,
- std::move (output_file));
+ std::move (output_file_));
return sink;
}
return nullptr;
}
- diagnostics::output_file output_file;
+ output_file output_file_;
if (filename.get ())
- output_file = ctxt.open_output_file (std::move (filename));
+ output_file_ = ctxt.open_output_file (std::move (filename));
else
// Default filename
{
"FILENAME");
return nullptr;
}
- output_file
+ output_file_
= diagnostic_output_format_open_html_file
(dc,
ctxt.get_affected_location_mgr (),
basename);
}
- if (!output_file)
+ if (!output_file_)
return nullptr;
html_generation_options html_gen_opts;
auto sink = make_html_sink (dc,
*ctxt.get_affected_location_mgr (),
html_gen_opts,
- std::move (output_file));
+ std::move (output_file_));
return sink;
}
-} // namespace diagnostics_output_spec
+} // namespace output_spec
+} // namespace diagnostics
#if CHECKING_P
struct parser_test
{
- class test_spec_context : public diagnostics_output_spec::gcc_spec_context
+ class test_spec_context : public diagnostics::output_spec::dc_spec_context
{
public:
test_spec_context (diagnostic_context &dc,
line_maps *location_mgr,
location_t loc,
const char *option_name)
- : gcc_spec_context (dc,
- location_mgr,
- location_mgr,
- loc,
- option_name)
+ : dc_spec_context (dc,
+ location_mgr,
+ location_mgr,
+ loc,
+ option_name)
{
}
pp_buffer (m_fmt.get_printer ())->m_flush_p = false;
}
- std::unique_ptr<diagnostics_output_spec::scheme_name_and_params>
+ std::unique_ptr<diagnostics::output_spec::scheme_name_and_params>
parse (const char *unparsed_arg)
{
- return diagnostics_output_spec::parse (m_ctxt, unparsed_arg);
+ return diagnostics::output_spec::parse (m_ctxt, unparsed_arg);
}
bool execution_failed_p () const
/* Run all of the selftests within this file. */
void
-diagnostic_output_spec_cc_tests ()
+diagnostics_output_spec_cc_tests ()
{
test_output_arg_parsing ();
}
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#ifndef GCC_DIAGNOSTIC_OUTPUT_SPEC_H
-#define GCC_DIAGNOSTIC_OUTPUT_SPEC_H
+#ifndef GCC_DIAGNOSTICS_OUTPUT_SPEC_H
+#define GCC_DIAGNOSTICS_OUTPUT_SPEC_H
#include "diagnostic-format.h"
#include "diagnostics/output-file.h"
-namespace diagnostics_output_spec {
+namespace diagnostics {
+namespace output_spec {
/* An abstract base class for handling the DSL of -fdiagnostics-add-output=
and -fdiagnostics-set-output=. */
const std::string &scheme_name,
const char *metavar) const;
- diagnostics::output_file
+ output_file
open_output_file (label_text &&filename) const;
const char *
/* A subclass that implements reporting errors via a diagnostic_context. */
-struct gcc_spec_context : public diagnostics_output_spec::context
+struct dc_spec_context : public output_spec::context
{
public:
- gcc_spec_context (diagnostic_context &dc,
- line_maps *affected_location_mgr,
- line_maps *control_location_mgr,
- location_t loc,
- const char *option_name)
+ dc_spec_context (diagnostic_context &dc,
+ line_maps *affected_location_mgr,
+ line_maps *control_location_mgr,
+ location_t loc,
+ const char *option_name)
: context (option_name, affected_location_mgr),
m_dc (dc),
m_control_location_mgr (control_location_mgr),
location_t m_loc;
};
-} // namespace diagnostics_output_spec
+} // namespace output_spec
+} // namespace diagnostics
-#endif
+#endif // #ifndef GCC_DIAGNOSTICS_OUTPUT_SPEC_H
#include "diagnostics/client-data-hooks.h"
#include "diagnostic-format-sarif.h"
#include "diagnostic-format-text.h"
-#include "diagnostic-output-spec.h"
+#include "diagnostics/output-spec.h"
#include "diagnostics/digraphs.h"
#include "diagnostics/state-graphs.h"
#include "diagnostics/logical-locations.h"
namespace {
-struct spec_context : public diagnostics_output_spec::context
+struct spec_context : public diagnostics::output_spec::context
{
public:
spec_context (const char *option_name,
/* This file implements the options -fdiagnostics-add-output=,
-fdiagnostics-set-output=. Most of the work is done
- by diagnostic-output-spec.cc so it can be shared by libgdiagnostics. */
+ by diagnostics/output-spec.cc so it can be shared by libgdiagnostics. */
#include "config.h"
#define INCLUDE_ARRAY
#include "version.h"
#include "intl.h"
#include "diagnostic.h"
-#include "diagnostic-output-spec.h"
+#include "diagnostics/output-spec.h"
#include "opts.h"
#include "options.h"
namespace {
-struct opt_spec_context : public diagnostics_output_spec::gcc_spec_context
+struct opt_spec_context : public diagnostics::output_spec::dc_spec_context
{
public:
opt_spec_context (const gcc_options &opts,
line_maps *location_mgr,
location_t loc,
const char *option_name)
- : gcc_spec_context (dc,
- location_mgr,
- location_mgr,
- loc,
- option_name),
+ : dc_spec_context (dc,
+ location_mgr,
+ location_mgr,
+ loc,
+ option_name),
m_opts (opts)
{}
diagnostic_format_html_cc_tests ();
diagnostic_format_sarif_cc_tests ();
diagnostics_digraphs_cc_tests ();
- diagnostic_output_spec_cc_tests ();
+ diagnostics_output_spec_cc_tests ();
diagnostics_state_graphs_cc_tests ();
edit_context_cc_tests ();
fold_const_cc_tests ();
extern void diagnostic_color_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 diagnostics_digraphs_cc_tests ();
+extern void diagnostics_output_spec_cc_tests ();
extern void diagnostics_selftest_logical_locations_cc_tests ();
extern void diagnostics_state_graphs_cc_tests ();
extern void digraph_cc_tests ();