+2020-02-17 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostic.c (print_any_cwe): Don't call get_cwe_url if URLs
+ won't be printed.
+ (print_option_information): Don't call get_option_url if URLs
+ won't be printed.
+
2020-02-17 Alexandre Oliva <oliva@adacore.com>
* tree-emutls.c (new_emutls_decl, emutls_common_1): Complete
pp_string (pp, " [");
pp_string (pp, colorize_start (pp_show_color (pp),
diagnostic_kind_color[diagnostic->kind]));
- char *cwe_url = get_cwe_url (cwe);
- pp_begin_url (pp, cwe_url);
- free (cwe_url);
+ if (pp->url_format != URL_FORMAT_NONE)
+ {
+ char *cwe_url = get_cwe_url (cwe);
+ pp_begin_url (pp, cwe_url);
+ free (cwe_url);
+ }
pp_printf (pp, "CWE-%i", cwe);
pp_set_prefix (context->printer, saved_prefix);
- pp_end_url (pp);
+ if (pp->url_format != URL_FORMAT_NONE)
+ pp_end_url (pp);
pp_string (pp, colorize_stop (pp_show_color (pp)));
pp_character (pp, ']');
}
if (option_text)
{
char *option_url = NULL;
- if (context->get_option_url)
+ if (context->get_option_url
+ && context->printer->url_format != URL_FORMAT_NONE)
option_url = context->get_option_url (context,
diagnostic->option_index);
pretty_printer *pp = context->printer;