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

2019-03-11 Thread Alexander Monakov


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 % intrinsic must be an 8-bit immediate"?

Thanks.
Alexander

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

2019-03-11 Thread Jakub Jelinek
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


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

2019-03-11 Thread Martin Liška
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
>From fb2e96c246e0dd99afafcc3ec24e766657ca2496 Mon Sep 17 00:00:00 2001
From: marxin 
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  

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

gcc/ChangeLog:

2019-03-11  Martin Liska  

	* 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  

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

gcc/cp/ChangeLog:

2019-03-11  Martin Liska  

	* 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  

	* 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, ))
-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)
@@