aboutsummaryrefslogtreecommitdiff
path: root/gcc/dumpfile.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-11-25 14:05:01 -0700
committerMartin Sebor <msebor@redhat.com>2020-11-25 15:00:27 -0700
commitca23341b28cd3af7985b83a6479107d9ea145a90 (patch)
treeabaa791c43dac7f771cdc4dd863821bb89325df3 /gcc/dumpfile.c
parent15f82d80cfbf834365f5819d75aaa9eeb9321224 (diff)
downloadgcc-ca23341b28cd3af7985b83a6479107d9ea145a90.zip
gcc-ca23341b28cd3af7985b83a6479107d9ea145a90.tar.gz
gcc-ca23341b28cd3af7985b83a6479107d9ea145a90.tar.bz2
Clean up -Wformat-diag warnings (PR bootstrap/97622, PR bootstrap/94982)
gcc/c-family/ChangeLog: PR bootstrap/94982 * c-attribs.c (handle_patchable_function_entry_attribute): Avoid -Wformat-diag. gcc/cp/ChangeLog: PR bootstrap/94982 * constraint.cc (debug_argument_list): Avoid -Wformat-diag. * error.c (function_category): Same. (print_template_differences): Same. * logic.cc (debug): Same. * name-lookup.c (lookup_using_decl): Same. * parser.c (maybe_add_cast_fixit): Same. (cp_parser_template_introduction): Same. * typeck.c (access_failure_info::add_fixit_hint): Same. gcc/ChangeLog: PR bootstrap/97622 PR bootstrap/94982 * config/i386/i386-options.c (ix86_valid_target_attribute_inner_p): Avoid -Wformat-diag. * digraph.cc (struct test_edge): Same. * dumpfile.c (dump_loc): Same. (dump_context::begin_scope): Same. * edit-context.c (edited_file::print_diff): Same. (edited_file::print_diff_hunk): Same. * json.cc (object::print): Same. * lto-wrapper.c (merge_and_complain): Same. * reload.c (find_reloads): Same. * tree-diagnostic-path.cc (print_path_summary_as_text): Same. * ubsan.c (ubsan_type_descriptor): Same. gcc/jit/ChangeLog: PR bootstrap/94982 * jit-recording.c (recording::function::dump_to_dot): Avoid -Wformat-diag. (recording::block::dump_to_dot): Same. gcc/testsuite/ChangeLog: PR bootstrap/94982 * c-c++-common/patchable_function_entry-error-3.c: Adjust text of expected warning.
Diffstat (limited to 'gcc/dumpfile.c')
-rw-r--r--gcc/dumpfile.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 8e53aef..80a65fe 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -492,6 +492,14 @@ dump_loc (dump_flags_t dump_kind, FILE *dfile, location_t loc)
static void
dump_loc (dump_flags_t dump_kind, pretty_printer *pp, location_t loc)
{
+ /* Disable warnings about missing quoting in GCC diagnostics for
+ the pp_printf calls. Their format strings aren't used to format
+ diagnostics so don't need to follow GCC diagnostic conventions. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
@@ -507,6 +515,10 @@ dump_loc (dump_flags_t dump_kind, pretty_printer *pp, location_t loc)
for (unsigned i = 0; i < get_dump_scope_depth (); i++)
pp_character (pp, ' ');
}
+
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
}
/* Implementation of dump_context member functions. */
@@ -1118,8 +1130,12 @@ dump_context::begin_scope (const char *name,
if (m_test_pp && apply_dump_filter_p (MSG_NOTE, m_test_pp_flags))
::dump_loc (MSG_NOTE, m_test_pp, src_loc);
+ /* Format multiple consecutive punctuation characters via %s to
+ avoid -Wformat-diag in the pp_printf call below whose output
+ isn't used for diagnostic output. */
pretty_printer pp;
- pp_printf (&pp, "=== %s ===\n", name);
+ pp_printf (&pp, "%s %s %s", "===", name, "===");
+ pp_newline (&pp);
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
xstrdup (pp_formatted_text (&pp)));