From 4ded42c2c5a5c977dbf67b71c5d78f8a6dca7cbb Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 4 Jan 2024 09:36:28 -0500 Subject: options: wire up options-urls.cc into gcc_urlifier Changed in v2: - split out from the code that generates options-urls.cc - call the generated function, rather than use a generated array - pass around lang_mask gcc/ChangeLog: * diagnostic.h (diagnostic_make_option_url_cb): Add lang_mask param. (diagnostic_context::make_option_url): Update for lang_mask param. * gcc-urlifier.cc: Include "opts.h" and "options.h". (gcc_urlifier::gcc_urlifier): Add lang_mask param. (gcc_urlifier::m_lang_mask): New field. (doc_urls): Make static. (gcc_urlifier::get_url_for_quoted_text): Use label_text. (gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text. Look for an option by name before trying a binary search in doc_urls. (gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text. (gcc_urlifier::get_url_suffix_for_option): New. (make_gcc_urlifier): Add lang_mask param. (selftest::gcc_urlifier_cc_tests): Update for above changes. Verify that a URL is found for "-fpack-struct". * gcc-urlifier.def: Drop options "--version" and "-fpack-struct". * gcc-urlifier.h (make_gcc_urlifier): Add lang_mask param. * gcc.cc (driver::global_initializations): Pass 0 for lang_mask to make_gcc_urlifier. * opts-diagnostic.h (get_option_url): Add lang_mask param. * opts.cc (get_option_html_page): Remove special-casing for analyzer and LTO. (get_option_url_suffix): New. (get_option_url): Reimplement. (selftest::test_get_option_html_page): Rename to... (selftest::test_get_option_url_suffix): ...this and update for above changes. (selftest::opts_cc_tests): Update for renaming. * opts.h: Include "rich-location.h". (get_option_url_suffix): New decl. gcc/testsuite/ChangeLog: * lib/gcc-dg.exp: Set TERM to xterm. gcc/ChangeLog: * toplev.cc (general_init): Pass lang_mask to urlifier. Signed-off-by: David Malcolm --- gcc/diagnostic.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/diagnostic.h') diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 566772c..0a7c7e0 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -186,7 +186,8 @@ typedef char *(*diagnostic_make_option_name_cb) (const diagnostic_context *, diagnostic_t, diagnostic_t); typedef char *(*diagnostic_make_option_url_cb) (const diagnostic_context *, - int); + int, + unsigned); class edit_context; namespace json { class value; } @@ -526,7 +527,8 @@ public: { if (!m_option_callbacks.m_make_option_url_cb) return nullptr; - return m_option_callbacks.m_make_option_url_cb (this, option_index); + return m_option_callbacks.m_make_option_url_cb (this, option_index, + get_lang_mask ()); } void -- cgit v1.1