Commit graph

5 commits

Author SHA1 Message Date
Jakub Jelinek
a945c346f5 Update copyright years. 2024-01-03 12:19:35 +01:00
David Malcolm
8fc4e6c397 diagnostics: use const and references for diagnostic_info
No functional change intended.

gcc/c-family/ChangeLog:
	* c-opts.cc (c_diagnostic_finalizer): Make "diagnostic" param
	const.

gcc/cp/ChangeLog:
	* cp-tree.h (cxx_print_error_function): Make diagnostic_info param
	const.
	* error.cc (cxx_print_error_function): Likewise.
	(cp_diagnostic_starter): Likewise.
	(cp_print_error_function): Likewise.

gcc/ChangeLog:
	* diagnostic-format-json.cc (on_begin_diagnostic): Convert param
	to const reference.
	(on_end_diagnostic): Likewise.
	(json_output_format::on_end_diagnostic): Likewise.
	* diagnostic-format-sarif.cc
	(sarif_invocation::add_notification_for_ice): Likewise.
	(sarif_result::on_nested_diagnostic): Likewise.
	(sarif_ice_notification::sarif_ice_notification): Likewise.
	(sarif_builder::end_diagnostic): Likewise.
	(sarif_builder::make_result_object): Likewise.
	(make_reporting_descriptor_object_for_warning): Likewise.
	(sarif_builder::make_locations_arr): Likewise.
	(sarif_output_format::on_begin_diagnostic): Likewise.
	(sarif_output_format::on_end_diagnostic): Likewise.
	* diagnostic.cc (default_diagnostic_starter): Make diagnostic_info
	param const.
	(default_diagnostic_finalizer): Likewise.
	(diagnostic_context::report_diagnostic): Pass diagnostic by
	reference to on_{begin,end}_diagnostic.
	(diagnostic_text_output_format::on_begin_diagnostic): Convert
	param to const reference.
	(diagnostic_text_output_format::on_end_diagnostic): Likewise.
	* diagnostic.h (diagnostic_starter_fn): Make diagnostic_info param
	const.
	(diagnostic_finalizer_fn): Likeewise.
	(diagnostic_output_format::on_begin_diagnostic): Convert param to
	const reference.
	(diagnostic_output_format::on_end_diagnostic): Likewise.
	(diagnostic_text_output_format::on_begin_diagnostic): Likewise.
	(diagnostic_text_output_format::on_end_diagnostic): Likewise.
	(default_diagnostic_starter): Make diagnostic_info param const.
	(default_diagnostic_finalizer): Likewise.
	* langhooks-def.h (lhd_print_error_function): Make diagnostic_info
	param const.
	* langhooks.cc (lhd_print_error_function): Likewise.
	* langhooks.h (lang_hooks::print_error_function): Likewise.
	* tree-diagnostic.cc (diagnostic_report_current_function):
	Likewise.
	(default_tree_diagnostic_starter): Likewise.
	(virt_loc_aware_diagnostic_finalizer): Likewise.
	* tree-diagnostic.h (diagnostic_report_current_function):
	Likewise.
	(virt_loc_aware_diagnostic_finalizer): Likewise.

gcc/fortran/ChangeLog:
	* error.cc (gfc_diagnostic_starter): Make diagnostic_info param
	const.
	(gfc_diagnostic_finalizer): Likewise.

gcc/jit/ChangeLog:
	* dummy-frontend.cc (jit_begin_diagnostic): Make diagnostic_info
	param const.
	(jit_end_diagnostic): Likewise.  Pass to add_diagnostic by
	reference.
	* jit-playback.cc (jit::playback::context::add_diagnostic):
	Convert diagnostic_info to const reference.
	* jit-playback.h (jit::playback::context::add_diagnostic):
	Likewise.

gcc/testsuite/ChangeLog:
	* g++.dg/plugin/show_template_tree_color_plugin.c
	(noop_starter_fn): Make diagnostic_info param const.
	* gcc.dg/plugin/diagnostic_group_plugin.c
	(test_diagnostic_starter): Likewise.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(custom_diagnostic_finalizer): Likewise.
	* gcc.dg/plugin/location_overflow_plugin.c
	(verify_unpacked_ranges): Likewise.
	(verify_no_columns): Likewise.

libcc1/ChangeLog:
	* context.cc (plugin_print_error_function): Make diagnostic_info
	param const.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-12-06 12:35:08 -05:00
Jakub Jelinek
83ffe9cde7 Update copyright years. 2023-01-16 11:52:17 +01:00
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Tom Tromey
0624823260 libcc1: share basic context code
Both plugins in libcc1 share a fair amount of boilerplate.  They both
share error-emission code, context management code, and tree GC code.
This patch unifies these two bodies of code, avoiding needless
duplication.

libcc1

	* libcc1plugin.cc: Move code to context.cc.
	* libcp1plugin.cc: Move code to context.cc.
	* context.hh: New file.
	* context.cc: New file.
	* Makefile.in: Rebuild.
	* Makefile.am (AM_CPPFLAGS): Add more gcc flags.
	(CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): Update.
	(libcc1plugin_la_SOURCES): Add context.hh, context.cc.
	(libcp1plugin_la_SOURCES): Likewise.
2021-05-05 00:06:17 -06:00