From 6ecc1e32353e331137647a65a611eeb01b22184c Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 4 Jan 2024 09:36:28 -0500 Subject: opts: add logic to generate options-urls.cc Changed in v2: - split out from the code that uses this - now handles lang-specific URLs, as well as generic URLs - the generated options-urls.cc now contains a function with a switch statement, rather than an array, to support lang-specific URLs: const char * get_opt_url_suffix (int option_index, unsigned lang_mask) { switch (option_index) { [...snip...] case OPT_B: if (lang_mask & CL_D) return "gdc/Directory-Options.html#index-B"; return "gcc/Directory-Options.html#index-B"; [...snip...] return nullptr; } gcc/ChangeLog: * Makefile.in (ALL_OPT_URL_FILES): New. (GCC_OBJS): Add options-urls.o. (OBJS): Likewise. (OBJS-libcommon): Likewise. (s-options): Depend on $(ALL_OPT_URL_FILES), and add this to inputs to opt-gather.awk. (options-urls.cc): New Makefile target. * opt-functions.awk (url_suffix): New function. (lang_url_suffix): New function. * options-urls-cc-gen.awk: New file. * opts.h (get_opt_url_suffix): New decl. Signed-off-by: David Malcolm --- gcc/opts.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/opts.h') diff --git a/gcc/opts.h b/gcc/opts.h index 866a137..20419e4 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -152,6 +152,10 @@ struct cl_option_state { extern const struct cl_option cl_options[]; extern const unsigned int cl_options_count; + +extern const char * +get_opt_url_suffix (int option_index, unsigned lang_mask); + #ifdef ENABLE_PLUGIN extern const struct cl_var cl_vars[]; #endif -- cgit v1.1