From 4ded42c2c5a5c977dbf67b71c5d78f8a6dca7cbb Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
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 <dmalcolm@redhat.com>
---
 gcc/gcc-urlifier.def | 2 --
 1 file changed, 2 deletions(-)

(limited to 'gcc/gcc-urlifier.def')

diff --git a/gcc/gcc-urlifier.def b/gcc/gcc-urlifier.def
index 360de93..de6d9a3 100644
--- a/gcc/gcc-urlifier.def
+++ b/gcc/gcc-urlifier.def
@@ -16,5 +16,3 @@ DOC_URL ("#pragma pack", "gcc/Structure-Layout-Pragmas.html"),
 DOC_URL ("#pragma redefine_extname", "gcc/Symbol-Renaming-Pragmas.html"),
 DOC_URL ("#pragma scalar_storage_order", "gcc/Structure-Layout-Pragmas.html"),
 DOC_URL ("#pragma weak", "gcc/Weak-Pragmas.html"),
-DOC_URL ("--version", "gcc/Overall-Options.html#index-version"),
-DOC_URL ("-fpack-struct", "gcc/Code-Gen-Options.html#index-fpack-struct"),
-- 
cgit v1.1

