Skip to content
Snippets Groups Projects
Commit 89991f31 authored by David Malcolm's avatar David Malcolm
Browse files

diagnostics: introduce struct diagnostic_option_id


Use a new struct diagnostic_option_id rather than just "int" when
referring to command-line options controlling warnings in the
diagnostic subsystem.

No functional change intended, but better documents the meaning of
the code.

gcc/c-family/ChangeLog:
	* c-common.cc (c_option_controlling_cpp_diagnostic): Return
	diagnostic_option_id rather than int.
	(c_cpp_diagnostic): Update for renaming of
	diagnostic_override_option_index to diagnostic_set_option_id.

gcc/c/ChangeLog:
	* c-errors.cc (pedwarn_c23): Use "diagnostic_option_id option_id"
	rather than "int opt".  Update for renaming of diagnostic_info
	field.
	(pedwarn_c11): Likewise.
	(pedwarn_c99): Likewise.
	(pedwarn_c90): Likewise.
	* c-tree.h (pedwarn_c90): Likewise for decl.
	(pedwarn_c99): Likewise.
	(pedwarn_c11): Likewise.
	(pedwarn_c23): Likewise.

gcc/cp/ChangeLog:
	* constexpr.cc (constexpr_error): Update for renaming of
	diagnostic_info field.
	* cp-tree.h (pedwarn_cxx98): Use "diagnostic_option_id" rather
	than "int".
	* error.cc (cp_adjust_diagnostic_info): Update for renaming of
	diagnostic_info field.
	(pedwarn_cxx98): Use "diagnostic_option_id option_id" rather than
	"int opt".  Update for renaming of diagnostic_info field.
	(diagnostic_set_info): Likewise.

gcc/d/ChangeLog:
	* d-diagnostic.cc (d_diagnostic_report_diagnostic): Update for
	renaming of diagnostic_info field.

gcc/ChangeLog:
	* diagnostic-core.h (struct diagnostic_option_id): New.
	(warning): Use it rather than "int" for param.
	(warning_n): Likewise.
	(warning_at): Likewise.
	(warning_meta): Likewise.
	(pedwarn): Likewise.
	(permerror_opt): Likewise.
	(emit_diagnostic): Likewise.
	(emit_diagnostic_valist): Likewise.
	(emit_diagnostic_valist_meta): Likewise.
	* diagnostic-format-json.cc
	(json_output_format::on_report_diagnostic): Update for renaming of
	diagnostic_info field.
	* diagnostic-format-sarif.cc (sarif_builder::make_result_object):
	Likewise.
	(make_reporting_descriptor_object_for_warning): Likewise.
	* diagnostic-format-text.cc (print_option_information): Likewise.
	* diagnostic-global-context.cc (emit_diagnostic): Use
	"diagnostic_option_id option_id" rather than "int opt".
	(emit_diagnostic_valist): Likewise.
	(emit_diagnostic_valist_meta): Likewise.
	(warning): Likewise.
	(warning_at): Likewise.
	(warning_meta): Likewise.
	(warning_n): Likewise.
	(pedwarn): Likewise.
	(permerror_opt): Likewise.
	* diagnostic.cc (diagnostic_set_info_translated): Update for
	renaming of diagnostic_info field.
	(diagnostic_option_classifier::classify_diagnostic): Use
	"diagnostic_option_id option_id" rather than "int opt".
	(update_effective_level_from_pragmas): Update for renaming of
	diagnostic_info field.
	(diagnostic_context::diagnostic_enabled): Likewise.
	(diagnostic_context::warning_enabled_at): Use
	"diagnostic_option_id option_id" rather than "int opt".
	(diagnostic_context::diagnostic_impl): Likewise.
	(diagnostic_context::diagnostic_n_impl): Likewise.
	* diagnostic.h (diagnostic_info::diagnostic_info): Update for...
	(diagnostic_info::option_index): Rename...
	(diagnostic_info::option_id): ...to this.
	(class diagnostic_option_manager): Use
	"diagnostic_option_id option_id" rather than "int opt" for vfuncs.
	(diagnostic_option_classifier): Likewise for member funcs.
	(diagnostic_classification_change_t::option): Add comment.
	(diagnostic_context::warning_enabled_at): Use
	"diagnostic_option_id option_id" rather than "int option_index".
	(diagnostic_context::option_unspecified_p): Likewise.
	(diagnostic_context::classify_diagnostic): Likewise.
	(diagnostic_context::option_enabled_p): Likewise.
	(diagnostic_context::make_option_name): Likewise.
	(diagnostic_context::make_option_url): Likewise.
	(diagnostic_context::diagnostic_impl): Likewise.
	(diagnostic_context::diagnostic_n_impl): Likewise.
	(diagnostic_override_option_index): Rename...
	(diagnostic_set_option_id): ...to this, and update for
	diagnostic_info field renaming.
	(diagnostic_classify_diagnostic): Use "diagnostic_option_id"
	rather than "int".
	(warning_enabled_at): Likewise.
	(option_unspecified_p): Likewise.

gcc/fortran/ChangeLog:
	* cpp.cc (cb_cpp_diagnostic_cpp_option): Convert return type from
	"int" to "diagnostic_option_id".
	(cb_cpp_diagnostic): Update for renaming of
	diagnostic_override_option_index to diagnostic_set_option_id.
	* error.cc (gfc_warning): Update for renaming of diagnostic_info
	field.
	(gfc_warning_now_at): Likewise.
	(gfc_warning_now): Likewise.
	(gfc_warning_internal): Likewise.

gcc/ChangeLog:
	* ipa-pure-const.cc: Replace include of "opts.h" with
	"opts-diagnostic.h".
	(suggest_attribute): Convert param from int to
	diagnostic_option_id.
	* lto-wrapper.cc (class lto_diagnostic_option_manager): Use
	diagnostic_option_id rather than "int".
	* opts-common.cc
	(compiler_diagnostic_option_manager::option_enabled_p): Likewise.
	* opts-diagnostic.h (class gcc_diagnostic_option_manager):
	Likewise.
	(class compiler_diagnostic_option_manager): Likewise.
	* opts.cc (compiler_diagnostic_option_manager::make_option_name):
	Likewise.
	(gcc_diagnostic_option_manager::make_option_url): Likewise.
	* substring-locations.cc
	(format_string_diagnostic_t::emit_warning_n_va): Likewise.
	(format_string_diagnostic_t::emit_warning_va): Likewise.
	(format_string_diagnostic_t::emit_warning): Likewise.
	(format_string_diagnostic_t::emit_warning_n): Likewise.
	* substring-locations.h
	(format_string_diagnostic_t::emit_warning_va): Likewise.
	(format_string_diagnostic_t::emit_warning_n_va): Likewise.
	(format_string_diagnostic_t::emit_warning): Likewise.
	(format_string_diagnostic_t::emit_warning_n): Likewise.

Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
parent a97448e9
No related branches found
No related tags found
No related merge requests found
Showing
with 263 additions and 168 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment