diff mbox series

[2/N] Wrap apostrophes in gcc internal format with %'.

Message ID cdd8bbe2-03e8-626a-88e1-be9a36b3583d@suse.cz
State New
Headers show
Series [2/N] Wrap apostrophes in gcc internal format with %'. | expand

Commit Message

Martin Liška March 11, 2019, 1:25 p.m. UTC
Hi.

There's second part where I wrap apostrophes.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

Comments

Jakub Jelinek March 11, 2019, 1:38 p.m. UTC | #1
On Mon, Mar 11, 2019 at 02:25:59PM +0100, Martin Liška wrote:
> @@ -38375,7 +38375,7 @@ rdseed_step:
>        mode0 = insn_data[icode].operand[0].mode;
>        if (!insn_data[icode].operand[0].predicate (op0, mode0))
>  	{
> -	  error ("the xabort's argument must be an 8-bit immediate");
> +	  error ("the xabort%'s argument must be an 8-bit immediate");
>  	  return const0_rtx;
>  	}
>        emit_insn (gen_xabort (op0));

I'd drop the 's here instead and maybe the as well?

> --- a/gcc/d/dmd/expressionsem.c
> +++ b/gcc/d/dmd/expressionsem.c
> @@ -1366,7 +1366,7 @@ public:
>          }
>          else
>          {
> -            exp->error("new can only create structs, dynamic arrays or class objects, not %s's", exp->type->toChars());
> +            exp->error("new can only create structs, dynamic arrays or class objects, not %s%'s", exp->type->toChars());
>              return setError();
>          }
>  

I think for D you need to go through Iain Buclaw, I have no idea if
exp->error even has the gcc internal format infrastructure.  Can you split
that part of the patch and post it independently?

Otherwise LGTM.

	Jakub
Alexander Monakov March 11, 2019, 2:03 p.m. UTC | #2
On Mon, 11 Mar 2019, Jakub Jelinek wrote:

> On Mon, Mar 11, 2019 at 02:25:59PM +0100, Martin Liška wrote:
> > @@ -38375,7 +38375,7 @@ rdseed_step:
> >        mode0 = insn_data[icode].operand[0].mode;
> >        if (!insn_data[icode].operand[0].predicate (op0, mode0))
> >  	{
> > -	  error ("the xabort's argument must be an 8-bit immediate");
> > +	  error ("the xabort%'s argument must be an 8-bit immediate");
> >  	  return const0_rtx;
> >  	}
> >        emit_insn (gen_xabort (op0));
> 
> I'd drop the 's here instead and maybe the as well?

If this is going to be changed anyway, can it be cleared up like this:

  "the argument to %<xabort%> intrinsic must be an 8-bit immediate"?

Thanks.
Alexander
diff mbox series

Patch

From fb2e96c246e0dd99afafcc3ec24e766657ca2496 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 11 Mar 2019 10:13:41 +0100
Subject: [PATCH] Wrap apostrophes in gcc internal format with %'.

contrib/ChangeLog:

2019-03-11  Martin Liska  <mliska@suse.cz>

	* check-internal-format-escaping.py: Uncomment apostrophes
	check.

gcc/ChangeLog:

2019-03-11  Martin Liska  <mliska@suse.cz>

	* collect-utils.c (collect_wait): Wrap apostrophes
	in gcc internal format with %'.
	* collect2.c (main): Likewise.
	(scan_prog_file): Likewise.
	(scan_libraries): Likewise.
	* config/i386/i386.c (ix86_expand_call): Likewise.
	(ix86_handle_interrupt_attribute): Likewise.
	* config/nds32/nds32-intrinsic.c (nds32_expand_builtin_impl): Likewise.
	* config/nds32/nds32.c (nds32_insert_attributes): Likewise.
	* config/rl78/rl78.c (rl78_handle_saddr_attribute): Likewise.
	* lto-wrapper.c (find_crtoffloadtable): Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* tree-cfg.c (verify_gimple_label): Likewise.
	* tree.c (verify_type_variant): Likewise.

gcc/c-family/ChangeLog:

2019-03-11  Martin Liska  <mliska@suse.cz>

	* c-opts.c (c_common_post_options): Wrap apostrophes
	in gcc internal format with %'.

gcc/cp/ChangeLog:

2019-03-11  Martin Liska  <mliska@suse.cz>

	* cvt.c (build_expr_type_conversion): Wrap apostrophes
	in gcc internal format with %'.
	* decl.c (check_no_redeclaration_friend_default_args): Likewise.
	(grokfndecl): Likewise.
	* name-lookup.c (do_pushtag): Likewise.
	* pt.c (unify_parameter_deduction_failure): Likewise.
	(unify_template_deduction_failure): Likewise.

gcc/d/ChangeLog:

2019-03-11  Martin Liska  <mliska@suse.cz>

	* dmd/expressionsem.c: Wrap apostrophes
	in gcc internal format with %'.
---
 contrib/check-internal-format-escaping.py |  4 ++--
 gcc/c-family/c-opts.c                     |  2 +-
 gcc/collect-utils.c                       |  2 +-
 gcc/collect2.c                            |  6 +++---
 gcc/config/i386/i386.c                    |  6 +++---
 gcc/config/nds32/nds32-intrinsic.c        |  8 ++++----
 gcc/config/nds32/nds32.c                  |  2 +-
 gcc/config/rl78/rl78.c                    |  2 +-
 gcc/cp/cvt.c                              |  2 +-
 gcc/cp/decl.c                             |  4 ++--
 gcc/cp/name-lookup.c                      |  2 +-
 gcc/cp/pt.c                               |  4 ++--
 gcc/d/dmd/expressionsem.c                 |  8 ++++----
 gcc/lto-wrapper.c                         |  2 +-
 gcc/symtab.c                              |  8 ++++----
 gcc/tree-cfg.c                            |  2 +-
 gcc/tree.c                                | 16 ++++++++--------
 17 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/contrib/check-internal-format-escaping.py b/contrib/check-internal-format-escaping.py
index 5513b762271..5da56b59dd6 100755
--- a/contrib/check-internal-format-escaping.py
+++ b/contrib/check-internal-format-escaping.py
@@ -56,8 +56,8 @@  for i, l in enumerate(lines):
                             print('%s: %s' % (origin, text))
                     elif p.startswith('__builtin_'):
                         print('%s: %s' % (origin, text))
-#                    if re.search("[a-zA-Z]'[a-zA-Z]", p):
-#                        print('%s: %s' % (origin, text))
+                    if re.search("[a-zA-Z]'[a-zA-Z]", p):
+                        print('%s: %s' % (origin, text))
             j += 1
 
         origin = None
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 3233fdb9775..daa02a5e72d 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -945,7 +945,7 @@  c_common_post_options (const char **pfilename)
       if (flag_abi_version == latest_abi_version)
 	{
 	  auto_diagnostic_group d;
-	  if (warning (OPT_Wabi, "%<-Wabi%> won't warn about anything"))
+	  if (warning (OPT_Wabi, "%<-Wabi%> won%'t warn about anything"))
 	    {
 	      inform (input_location, "%<-Wabi%> warns about differences "
 		      "from the most up-to-date ABI, which is also used "
diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c
index fba3f7496ef..1e034433b80 100644
--- a/gcc/collect-utils.c
+++ b/gcc/collect-utils.c
@@ -65,7 +65,7 @@  collect_wait (const char *prog, struct pex_obj *pex)
   int status;
 
   if (!pex_get_status (pex, 1, &status))
-    fatal_error (input_location, "can't get program status: %m");
+    fatal_error (input_location, "can%'t get program status: %m");
   pex_free (pex);
 
   if (response_file && !save_temps)
diff --git a/gcc/collect2.c b/gcc/collect2.c
index da956bfd984..9d7de940ec1 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1396,7 +1396,7 @@  main (int argc, char **argv)
 
 		  stream = fopen (list_filename, "r");
 		  if (stream == NULL)
-		    fatal_error (input_location, "can't open %s: %m",
+		    fatal_error (input_location, "can%'t open %s: %m",
 				 list_filename);
 
 		  while (fgets (buf, sizeof buf, stream) != NULL)
@@ -2470,7 +2470,7 @@  scan_prog_file (const char *prog_name, scanpass which_pass,
 
   inf = pex_read_output (pex, 0);
   if (inf == NULL)
-    fatal_error (input_location, "can't open nm output: %m");
+    fatal_error (input_location, "can%'t open nm output: %m");
 
   if (debug)
     fprintf (stderr, "\nnm output with constructors/destructors.\n");
@@ -2639,7 +2639,7 @@  scan_libraries (const char *prog_name)
 
   inf = pex_read_output (pex, 0);
   if (inf == NULL)
-    fatal_error (input_location, "can't open ldd output: %m");
+    fatal_error (input_location, "can%'t open ldd output: %m");
 
   if (debug)
     notice ("\nldd output with constructors/destructors.\n");
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a4a7fbcfbe0..529c6afb37d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -28399,7 +28399,7 @@  ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
       if (fndecl
 	  && (lookup_attribute ("interrupt",
 				TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))))
-	error ("interrupt service routine can't be called directly");
+	error ("interrupt service routine can%'t be called directly");
     }
   else
     fndecl = NULL_TREE;
@@ -38375,7 +38375,7 @@  rdseed_step:
       mode0 = insn_data[icode].operand[0].mode;
       if (!insn_data[icode].operand[0].predicate (op0, mode0))
 	{
-	  error ("the xabort's argument must be an 8-bit immediate");
+	  error ("the xabort%'s argument must be an 8-bit immediate");
 	  return const0_rtx;
 	}
       emit_insn (gen_xabort (op0));
@@ -41440,7 +41440,7 @@  ix86_handle_interrupt_attribute (tree *node, tree, tree, int, bool *)
     error ("interrupt service routine can only have a pointer argument "
 	   "and an optional integer argument");
   if (! VOID_TYPE_P (return_type))
-    error ("interrupt service routine can't have non-void return value");
+    error ("interrupt service routine can%'t have non-void return value");
 
   return NULL_TREE;
 }
diff --git a/gcc/config/nds32/nds32-intrinsic.c b/gcc/config/nds32/nds32-intrinsic.c
index 04aa29095d7..c78dc935bf3 100644
--- a/gcc/config/nds32/nds32-intrinsic.c
+++ b/gcc/config/nds32/nds32-intrinsic.c
@@ -1000,7 +1000,7 @@  nds32_expand_builtin_impl (tree exp,
   if (!NDS32_EXT_DSP_P ()
       && fcode > NDS32_BUILTIN_DSP_BEGIN
       && fcode < NDS32_BUILTIN_DSP_END)
-    error ("don't support DSP extension instructions");
+    error ("don%'t support DSP extension instructions");
 
   switch (fcode)
     {
@@ -1059,7 +1059,7 @@  nds32_expand_builtin_impl (tree exp,
     case NDS32_BUILTIN_CLO:
       if (!TARGET_EXT_PERF)
 	{
-	  error ("don't support performance extension instructions");
+	  error ("don%'t support performance extension instructions");
 	  return NULL_RTX;
 	}
       break;
@@ -1071,7 +1071,7 @@  nds32_expand_builtin_impl (tree exp,
     case NDS32_BUILTIN_BSP:
       if (!TARGET_EXT_PERF2)
 	{
-	  error ("don't support performance extension "
+	  error ("don%'t support performance extension "
 		 "version 2 instructions");
 	  return NULL_RTX;
 	}
@@ -1083,7 +1083,7 @@  nds32_expand_builtin_impl (tree exp,
     case NDS32_BUILTIN_FLMISM:
       if (!TARGET_EXT_STRING)
 	{
-	  error ("don't support string extension instructions");
+	  error ("don%'t support string extension instructions");
 	  return NULL_RTX;
 	}
       break;
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 8bee154a429..f2723ea4cdc 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -3944,7 +3944,7 @@  nds32_insert_attributes (tree decl, tree *attributes)
 	new_attrs = tree_cons (get_identifier ("noclone"), NULL, new_attrs);
 
       if (!TREE_PUBLIC (decl))
-	error("indirect_call attribute can't apply for static function");
+	error ("indirect_call attribute can%'t apply for static function");
 
       *attributes = new_attrs;
     }
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index c127c506570..d2caa118281 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -864,7 +864,7 @@  rl78_handle_saddr_attribute (tree * node,
 
   if (TREE_CODE (* node) == FUNCTION_DECL)
     {
-      warning (OPT_Wattributes, "%qE attribute doesn't apply to functions",
+      warning (OPT_Wattributes, "%qE attribute doesn%'t apply to functions",
 	       name);
       * no_add_attrs = true;
     }
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index c10db92bd6f..3b8656c2a6b 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1822,7 +1822,7 @@  build_expr_type_conversion (int desires, tree expr, bool complain)
 	  if (TREE_CODE (cand) == TEMPLATE_DECL)
 	    {
 	      if (complain)
-		error ("default type conversion can't deduce template"
+		error ("default type conversion can%'t deduce template"
 		       " argument for %qD", cand);
 	      return error_mark_node;
 	    }
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 89edfe8ed01..c8435e29491 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1305,7 +1305,7 @@  check_no_redeclaration_friend_default_args (tree olddecl, tree newdecl,
 	auto_diagnostic_group d;
 	if (permerror (DECL_SOURCE_LOCATION (newdecl),
 		       "friend declaration of %q#D specifies default "
-		       "arguments and isn't the only declaration", newdecl))
+		       "arguments and isn%'t the only declaration", newdecl))
 	  inform (DECL_SOURCE_LOCATION (olddecl),
 		  "previous declaration of %q#D", olddecl);
 	return;
@@ -8913,7 +8913,7 @@  grokfndecl (tree ctype,
 	  {
 	    permerror (DECL_SOURCE_LOCATION (decl),
 		       "friend declaration of %qD specifies default "
-		       "arguments and isn't a definition", decl);
+		       "arguments and isn%'t a definition", decl);
 	    break;
 	  }
     }
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2ba888fd1c2..4ca976c812d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -6897,7 +6897,7 @@  do_pushtag (tree name, tree type, tag_scope scope)
 	      && !CLASSTYPE_TEMPLATE_INFO (type))
 	    {
 	      error ("declaration of %<std::initializer_list%> does not match "
-		     "%<#include <initializer_list>%>, isn't a template");
+		     "%<#include <initializer_list>%>, isn%'t a template");
 	      return error_mark_node;
 	    }
 	}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f48f4605b0f..2ab6e273c3a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6364,7 +6364,7 @@  unify_parameter_deduction_failure (bool explain_p, tree parm)
 {
   if (explain_p)
     inform (input_location,
-	    "  couldn't deduce template parameter %qD", parm);
+	    "  couldn%'t deduce template parameter %qD", parm);
   return unify_invalid (explain_p);
 }
 
@@ -6540,7 +6540,7 @@  unify_template_deduction_failure (bool explain_p, tree parm, tree arg)
 {
   if (explain_p)
     inform (input_location,
-	    "  can't deduce a template for %qT from non-template type %qT",
+	    "  can%'t deduce a template for %qT from non-template type %qT",
 	    parm, arg);
   return unify_invalid (explain_p);
 }
diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c
index 68f715a5fb8..cf09f097476 100644
--- a/gcc/d/dmd/expressionsem.c
+++ b/gcc/d/dmd/expressionsem.c
@@ -1366,7 +1366,7 @@  public:
         }
         else
         {
-            exp->error("new can only create structs, dynamic arrays or class objects, not %s's", exp->type->toChars());
+            exp->error("new can only create structs, dynamic arrays or class objects, not %s%'s", exp->type->toChars());
             return setError();
         }
 
@@ -6444,7 +6444,7 @@  public:
                 e = scaleFactor(exp, sc);
             else
             {
-                exp->error("can't subtract %s from pointer", t2->toChars());
+                exp->error("can%'t subtract %s from pointer", t2->toChars());
                 e = new ErrorExp();
             }
             result = e;
@@ -6453,7 +6453,7 @@  public:
         if (t2->ty == Tpointer)
         {
             exp->type = exp->e2->type;
-            exp->error("can't subtract pointer from %s", exp->e1->type->toChars());
+            exp->error("can%'t subtract pointer from %s", exp->e1->type->toChars());
             return setError();
         }
 
@@ -8702,6 +8702,6 @@  Expression *semanticY(DotTemplateInstanceExp *exp, Scope *sc, int flag)
         return e;
     }
 Lerr:
-    e->error("%s isn't a template", e->toChars());
+    e->error("%s isn%'t a template", e->toChars());
     return new ErrorExp();
 }
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index c079c7b7161..2cd69f24048 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -960,7 +960,7 @@  find_crtoffloadtable (void)
       }
   if (i == n_paths)
     fatal_error (input_location,
-		 "installation error, can't find crtoffloadtable.o");
+		 "installation error, can%'t find crtoffloadtable.o");
 
   free_array_of_ptrs ((void **) paths, n_paths);
 }
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 16a21359f8d..c3c057d3283 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1155,7 +1155,7 @@  symtab_node::verify_base (void)
     }
   if (implicit_section && !get_section ())
     {
-      error ("implicit_section flag is set but section isn't");
+      error ("implicit_section flag is set but section isn%'t");
       error_found = true;
     }
   if (get_section () && get_comdat_group ()
@@ -1174,14 +1174,14 @@  symtab_node::verify_base (void)
 	  || strcmp (get_section(),
 		     get_alias_target ()->get_section ())))
     {
-      error ("Alias and target's section differs");
+      error ("Alias and target%'s section differs");
       get_alias_target ()->dump (stderr);
       error_found = true;
     }
   if (alias && definition
       && get_comdat_group () != get_alias_target ()->get_comdat_group ())
     {
-      error ("Alias and target's comdat groups differs");
+      error ("Alias and target%'s comdat groups differs");
       get_alias_target ()->dump (stderr);
       error_found = true;
     }
@@ -1196,7 +1196,7 @@  symtab_node::verify_base (void)
 	    ultimate_transparent_alias_target (DECL_ASSEMBLER_NAME (to->decl)));
       if (!symbol_table::assembler_names_equal_p (name1, name2))
 	{
-	  error ("Transparent alias and target's assembler names differs");
+	  error ("Transparent alias and target%'s assembler names differs");
 	  get_alias_target ()->dump (stderr);
 	  error_found = true;
 	}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c8d6d1b12a9..805e8727ce0 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4827,7 +4827,7 @@  verify_gimple_label (glabel *stmt)
   if (!DECL_NONLOCAL (decl) && !FORCED_LABEL (decl)
       && DECL_CONTEXT (decl) != current_function_decl)
     {
-      error ("label's context is not the current function decl");
+      error ("label%'s context is not the current function decl");
       err |= true;
     }
 
diff --git a/gcc/tree.c b/gcc/tree.c
index 6528057524c..02721cfc8a0 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13815,9 +13815,9 @@  verify_type_variant (const_tree t, tree tv)
 					TYPE_SIZE_UNIT (tv), 0));
 	  error ("type variant has different TYPE_SIZE_UNIT");
 	  debug_tree (tv);
-	  error ("type variant's TYPE_SIZE_UNIT");
+	  error ("type variant%'s TYPE_SIZE_UNIT");
 	  debug_tree (TYPE_SIZE_UNIT (tv));
-	  error ("type's TYPE_SIZE_UNIT");
+	  error ("type%'s TYPE_SIZE_UNIT");
 	  debug_tree (TYPE_SIZE_UNIT (t));
 	  return false;
 	}
@@ -13888,9 +13888,9 @@  verify_type_variant (const_tree t, tree tv)
     {
       error ("type variant has different TYPE_BINFO");
       debug_tree (tv);
-      error ("type variant's TYPE_BINFO");
+      error ("type variant%'s TYPE_BINFO");
       debug_tree (TYPE_BINFO (tv));
-      error ("type's TYPE_BINFO");
+      error ("type%'s TYPE_BINFO");
       debug_tree (TYPE_BINFO (t));
       return false;
     }
@@ -13952,9 +13952,9 @@  verify_type_variant (const_tree t, tree tv)
     {
       error ("type variant has different TREE_TYPE");
       debug_tree (tv);
-      error ("type variant's TREE_TYPE");
+      error ("type variant%'s TREE_TYPE");
       debug_tree (TREE_TYPE (tv));
-      error ("type's TREE_TYPE");
+      error ("type%'s TREE_TYPE");
       debug_tree (TREE_TYPE (t));
       return false;
     }
@@ -13963,9 +13963,9 @@  verify_type_variant (const_tree t, tree tv)
     {
       error ("type is not compatible with its variant");
       debug_tree (tv);
-      error ("type variant's TREE_TYPE");
+      error ("type variant%'s TREE_TYPE");
       debug_tree (TREE_TYPE (tv));
-      error ("type's TREE_TYPE");
+      error ("type%'s TREE_TYPE");
       debug_tree (TREE_TYPE (t));
       return false;
     }
-- 
2.21.0