]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostics: replace option_hooks with a diagnostic_option_manager class
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 9 Sep 2024 23:38:12 +0000 (19:38 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 9 Sep 2024 23:38:12 +0000 (19:38 -0400)
commita97448e92eb76a69b4183183d14a791f9b76cc8d
tree115118c656d8bca355cce4f1d35136bbe862e96c
parent19363bf5564ffbe992265a1e69a0d99a0d29f016
diagnostics: replace option_hooks with a diagnostic_option_manager class

Introduce a diagnostic_option_manager class to help isolate the
diagnostics subsystem from GCC's option handling.

No functional change intended.

gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::initialize): Replace
m_options_callbacks with m_option_mgr.
(diagnostic_context::set_option_hooks): Replace with...
(diagnostic_context::set_option_manager): ...this.
* diagnostic.h (diagnostic_option_enabled_cb): Delete.
(diagnostic_make_option_name_cb): Delete.
(diagnostic_make_option_url_cb): Delete.
(class diagnostic_option_manager): New.
(diagnostic_manager::option_enabled_p): Convert from using
m_option_callbacks to m_option_mgr.
(diagnostic_manager::make_option_name): Likewise.
(diagnostic_manager::make_option_url): Likewise.
(diagnostic_manager::set_option_hooks): Replace with...
(diagnostic_manager::set_option_manager): ...this.
(diagnostic_manager::get_lang_mask): Update for field changes.
(diagnostic_manager::m_option_callbacks): Replace with...
(diagnostic_manager::m_option_mgr): ...this and...
(diagnostic_manager::m_lang_mask): ...this.
* lto-wrapper.cc (class lto_diagnostic_option_manager): New.
(main): Port from option hooks to diagnostic_option_manager.
* opts-common.cc: Include "opts-diagnostic.h".
(compiler_diagnostic_option_manager::option_enabled_p): New.
* opts-diagnostic.h (option_name): Drop decl.
(get_option_url): Drop decl.
(class gcc_diagnostic_option_manager): New.
(class compiler_diagnostic_option_manager): New.
* opts.cc (option_name): Convert to...
(compiler_diagnostic_option_manager::make_option_name): ...this.
(get_option_url): Convert to...
(gcc_diagnostic_option_manager::make_option_url): ...this.
* toplev.cc (general_init): Port from option hooks to
diagnostic_option_manager.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic.cc
gcc/diagnostic.h
gcc/lto-wrapper.cc
gcc/opts-common.cc
gcc/opts-diagnostic.h
gcc/opts.cc
gcc/toplev.cc