]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove support for %G and %K.
authorMartin Sebor <msebor@redhat.com>
Tue, 6 Jul 2021 20:13:31 +0000 (14:13 -0600)
committerMartin Sebor <msebor@redhat.com>
Tue, 6 Jul 2021 20:14:25 +0000 (14:14 -0600)
gcc/c-family/ChangeLog:

* c-format.c (gcc_tdiag_char_table): Remove support for %G and %K.
 (gcc_cdiag_char_table): Same.
 (gcc_cxxdiag_char_table): Same.

gcc/c/ChangeLog:

* c-objc-common.c (c_tree_printer): Remove support for %G and %K.

gcc/cp/ChangeLog:

* error.c (cp_printer):  Remove support for %G and %K.

gcc/ChangeLog:

* gimple-pretty-print.c (percent_G_format): Remove.
* tree-diagnostic.c (default_tree_printer): Remove calls.
* tree-pretty-print.c (percent_K_format): Remove.
* tree-pretty-print.h (percent_K_format): Remove.

gcc/testsuite/ChangeLog:

* gcc.dg/format/gcc_diag-10.c: Update expected warnings.
* gcc.dg/plugin/diagnostic_plugin_test_inlining.c: Remove %G.

gcc/c-family/c-format.c
gcc/c/c-objc-common.c
gcc/cp/error.c
gcc/gimple-pretty-print.c
gcc/testsuite/gcc.dg/format/gcc_diag-10.c
gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_inlining.c
gcc/tree-diagnostic.c
gcc/tree-pretty-print.c
gcc/tree-pretty-print.h

index bda3b18fcd0c97f871ff320e8d049a5a8d9d4f67..6fd0bb33d21554a2b70758a2cac1dc84bf1c610b 100644 (file)
@@ -781,10 +781,6 @@ static const format_char_info gcc_tdiag_char_table[] =
   /* These will require a "tree" at runtime.  */
   { "DFTV", 1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+", "'",   NULL },
   { "E", 1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+", "",   NULL },
-  { "K", 1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "", "\"",   NULL },
-
-  /* G requires a "gimple*" argument at runtime.  */
-  { "G", 1, STD_C89, { T89_G,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "", "\"",   NULL },
 
   { NULL,  0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
 };
@@ -799,10 +795,6 @@ static const format_char_info gcc_cdiag_char_table[] =
   /* These will require a "tree" at runtime.  */
   { "DFTV", 1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+", "'",   NULL },
   { "E",   1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+", "",   NULL },
-  { "K",   1, STD_C89, { T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "", "\"",   NULL },
-
-  /* G requires a "gimple*" argument at runtime.  */
-  { "G",   1, STD_C89, { T89_G,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "", "\"",   NULL },
 
   { "v",   0, STD_C89, { T89_I,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q#",  "",   NULL },
 
@@ -819,10 +811,6 @@ static const format_char_info gcc_cxxdiag_char_table[] =
   /* These will require a "tree" at runtime.  */
   { "ADFHISTVX",1,STD_C89,{ T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+#",   "'",   NULL },
   { "E", 1,STD_C89,{ T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q+#",   "",   NULL },
-  { "K", 1, STD_C89,{ T89_T,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",   "\"",   NULL },
-
-  /* G requires a "gimple*" argument at runtime.  */
-  { "G", 1, STD_C89,{ T89_G,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",   "\"",   NULL },
 
   /* These accept either an 'int' or an 'enum tree_code' (which is handled as an 'int'.)  */
   { "CLOPQ",0,STD_C89, { T89_I,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "q",  "",   NULL },
index b945de15ab84edcda3bb60b8cfd9033b4c9cd8d8..cdb2242758e6c798918a16110a31063569d6cbf2 100644 (file)
@@ -247,8 +247,6 @@ print_type (c_pretty_printer *cpp, tree t, bool *quoted)
    %D: a general decl,
    %E: an identifier or expression,
    %F: a function declaration,
-   %G: a Gimple statement,
-   %K: a CALL_EXPR,
    %T: a type.
    %V: a list of type qualifiers from a tree.
    %v: an explicit list of type qualifiers
@@ -269,19 +267,6 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
   if (precision != 0 || wide)
     return false;
 
-  if (*spec == 'G')
-    {
-      percent_G_format (text);
-      return true;
-    }
-
-  if (*spec == 'K')
-    {
-      t = va_arg (*text->args_ptr, tree);
-      percent_K_format (text, EXPR_LOCATION (t), TREE_BLOCK (t));
-      return true;
-    }
-
   if (*spec != 'v')
     {
       t = va_arg (*text->args_ptr, tree);
index 4a89b3488291480784d23b6fe53018b8cb18eb95..012a4ecddf44661f12d8df1d5e474614b5de3d39 100644 (file)
@@ -4338,10 +4338,8 @@ defer_phase_2_of_type_diff (deferred_printed_type *deferred,
    %D   declaration.
    %E   expression.
    %F   function declaration.
-   %G   gcall *
    %H   type difference (from).
    %I   type difference (to).
-   %K   tree
    %L  language as used in extern "lang".
    %O  binary operator.
    %P   function parameter whose position is indicated by an integer.
@@ -4391,9 +4389,6 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
       break;
     case 'E': result = expr_to_string (next_tree);             break;
     case 'F': result = fndecl_to_string (next_tree, verbose);  break;
-    case 'G':
-      percent_G_format (text);
-      return true;
     case 'H':
       defer_phase_2_of_type_diff (&postprocessor->m_type_a, next_tree,
                                  buffer_ptr, verbose, *quoted);
@@ -4402,10 +4397,6 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
       defer_phase_2_of_type_diff (&postprocessor->m_type_b, next_tree,
                                  buffer_ptr, verbose, *quoted);
       return true;
-    case 'K':
-      t = va_arg (*text->args_ptr, tree);
-      percent_K_format (text, EXPR_LOCATION (t), TREE_BLOCK (t));
-      return true;
     case 'L': result = language_to_string (next_lang);         break;
     case 'O': result = op_to_string (false, next_tcode);       break;
     case 'P': result = parm_to_string (next_int);              break;
index 8be40416dd2b3c74e2eaae8c678bfc17ff79f872..39c5775e2cb1f2aa994ae21c06f881c44c9844e1 100644 (file)
@@ -3059,23 +3059,6 @@ gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
   pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
 }
 
-
-/* Handle the %G format for TEXT.  Same as %K in handle_K_format in
-   tree-pretty-print.c but with a Gimple statement as an argument.  */
-
-void
-percent_G_format (text_info *text)
-{
-  gimple *stmt = va_arg (*text->args_ptr, gimple*);
-
-  /* Fall back on the rich location if the statement doesn't have one.  */
-  location_t loc = gimple_location (stmt);
-  if (loc == UNKNOWN_LOCATION)
-    loc = text->m_richloc->get_loc ();
-  tree block = gimple_block (stmt);
-  percent_K_format (text, loc, block);
-}
-
 #if __GNUC__ >= 10
 #  pragma GCC diagnostic pop
 #endif
index a2f99feefc93ec8641490aa5b826d4285f0dcb37..dd930f9241e13ea550e6052c402fe30cc329d43a 100644 (file)
@@ -64,8 +64,8 @@ void test_cdiag (tree t, gimple *gc)
   cdiag ("%D", t);       /* { dg-warning ".D. conversion used unquoted" } */
   cdiag ("%E", t);
   cdiag ("%F", t);       /* { dg-warning ".F. conversion used unquoted" } */
-  cdiag ("%G", gc);
-  cdiag ("%K", t);
+  cdiag ("%G", gc);      /* { dg-warning "format" } */
+  cdiag ("%K", t);       /* { dg-warning "format" } */
 
   cdiag ("%R");       /* { dg-warning "unmatched color reset directive" } */
   cdiag ("%r", "");   /* { dg-warning "unterminated color directive" } */
@@ -80,8 +80,8 @@ void test_cdiag (tree t, gimple *gc)
   cdiag ("%<%D%>", t);
   cdiag ("%<%E%>", t);
   cdiag ("%<%F%>", t);
-  cdiag ("%<%G%>", gc);  /* { dg-warning ".G. conversion used within a quoted sequence" } */
-  cdiag ("%<%K%>", t);   /* { dg-warning ".K. conversion used within a quoted sequence" } */
+  cdiag ("%<%G%>", gc);  /* { dg-warning "format" } */
+  cdiag ("%<%K%>", t);   /* { dg-warning "format" } */
 
   cdiag ("%<%R%>");      /* { dg-warning "unmatched color reset directive" } */
   cdiag ("%<%r%>", "");  /* { dg-warning "unterminated color directive" } */
@@ -103,8 +103,8 @@ void test_tdiag (tree t, gimple *gc)
 
   tdiag ("%D", t);       /* { dg-warning ".D. conversion used unquoted" } */
   tdiag ("%E", t);
-  tdiag ("%G", gc);
-  tdiag ("%K", t);
+  tdiag ("%G", gc);     /* { dg-warning "format" } */
+  tdiag ("%K", t);      /* { dg-warning "format" } */
 
   tdiag ("%R");          /* { dg-warning "unmatched color reset directive" } */
   tdiag ("%r", "");   /* { dg-warning "unterminated color directive" } */
@@ -118,8 +118,8 @@ void test_tdiag (tree t, gimple *gc)
 
   tdiag ("%<%D%>", t);
   tdiag ("%<%E%>", t);
-  tdiag ("%<%G%>", gc);  /* { dg-warning ".G. conversion used within a quoted sequence" } */
-  tdiag ("%<%K%>", t);   /* { dg-warning ".K. conversion used within a quoted sequence" } */
+  tdiag ("%<%G%>", gc);  /* { dg-warning "format" } */
+  tdiag ("%<%K%>", t);   /* { dg-warning "format" } */
 
   tdiag ("%<%R%>");      /* { dg-warning "unmatched color reset directive" } */
   tdiag ("%<%r%>", "");  /* { dg-warning "unterminated color directive" } */
@@ -138,8 +138,8 @@ void test_cxxdiag (tree t, gimple *gc)
   cxxdiag ("%D", t);     /* { dg-warning ".D. conversion used unquoted" } */
   cxxdiag ("%E", t);
   cxxdiag ("%F", t);     /* { dg-warning ".F. conversion used unquoted" } */
-  cxxdiag ("%G", gc);
-  cxxdiag ("%K", t);
+  cxxdiag ("%G", gc);    /* { dg-warning "format" } */
+  cxxdiag ("%K", t);     /* { dg-warning "format" } */
 
   cxxdiag ("%R");        /* { dg-warning "unmatched color reset directive" } */
   cxxdiag ("%r", "");    /* { dg-warning "unterminated color directive" } */
index 02c4629bc29e2a9e40ca013dd7c59ab4c79276b6..d2bfca092a79f77e21dd9fab18594665eb3496e8 100644 (file)
@@ -133,7 +133,7 @@ test_inlining (gimple *stmt)
       return;
     }
 
-  warning_at (call->location, 0, "%G%s", call,
+  warning_at (call->location, 0, "%s",
              TREE_STRING_POINTER (t_string));
 }
 
index 1b636d72a29f86c67df69624f660830dc716628c..8bb214b2cf5203ad1578ea74ada58572a3d799b4 100644 (file)
@@ -276,15 +276,6 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
       t = va_arg (*text->args_ptr, tree);
       break;
 
-    case 'G':
-      percent_G_format (text);
-      return true;
-
-    case 'K':
-      t = va_arg (*text->args_ptr, tree);
-      percent_K_format (text, EXPR_LOCATION (t), TREE_BLOCK (t));
-      return true;
-
     default:
       return false;
     }
index bcbe669653c16620a71c76153710c644c3c36c4f..fde07dfd0e1938e732d268e07c8aa911613017a3 100644 (file)
@@ -4433,32 +4433,6 @@ newline_and_indent (pretty_printer *pp, int spc)
   INDENT (spc);
 }
 
-/* Handle the %K format for TEXT.  Separate from default_tree_printer
-   so it can also be used in front ends.
-   The location LOC and BLOCK are expected to be extracted by the caller
-   from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg).  */
-
-void
-percent_K_format (text_info *text, location_t loc, tree block)
-{
-  text->set_location (0, loc, SHOW_RANGE_WITH_CARET);
-  gcc_assert (pp_ti_abstract_origin (text) != NULL);
-  *pp_ti_abstract_origin (text) = NULL;
-
-  while (block
-        && TREE_CODE (block) == BLOCK
-        && BLOCK_ABSTRACT_ORIGIN (block))
-    {
-      tree ao = BLOCK_ABSTRACT_ORIGIN (block);
-      if (TREE_CODE (ao) == FUNCTION_DECL)
-       {
-         *pp_ti_abstract_origin (text) = block;
-         break;
-       }
-      block = BLOCK_SUPERCONTEXT (block);
-    }
-}
-
 /* Print the identifier ID to PRETTY-PRINTER.  */
 
 void
index cafe9aa95989c1761265c285f322b3388090c3de..dacd256302b2d453dd460307a6611ac279f96481 100644 (file)
@@ -52,7 +52,6 @@ extern int op_prio (const_tree);
 extern const char *op_symbol_code (enum tree_code);
 extern void pretty_print_string (pretty_printer *, const char *, size_t);
 extern void print_call_name (pretty_printer *, tree, dump_flags_t);
-extern void percent_K_format (text_info *, location_t, tree);
 extern void pp_tree_identifier (pretty_printer *, tree);
 extern void dump_function_header (FILE *, tree, dump_flags_t);
 extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);