diff mbox

Fix various cases of missing whitespace in string literals split across lines

Message ID 20170213194249.GM1849@tucnak
State New
Headers show

Commit Message

Jakub Jelinek Feb. 13, 2017, 7:42 p.m. UTC
Hi!

While looking at PR79475 (already fixed), I wrote a small scriptlet
#!/bin/awk -f
/^[[:blank:]]*"[^[:blank:]]/ {
  if (last)
    {
      print last
      print
    }
}
{
  last = ""
}
/[^[:blank:]]"[[:blank:]]*\\?$/ {
  if ($0 ~ /\\[tnv]"[[:blank:]]*\\?$/)
    last = ""
  else
    last = $0
}
to look for possible issues like
	"something"
	"and something"
where there probably is supposed to be a space in between.  It shows
various false positives (especially in the spec handling stuff) and while
it handles
	"something\n"
	"something else"
it doesn't handle
	"something"
	"\nsomething else"
but in any case the false positive ratio was small enough that I could
easily look for actual bugs.  This patch fixes various of these
in the middle end as well as C and fortran FEs.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-02-13  Jakub Jelinek  <jakub@redhat.com>

	* cprop.c (cprop_jump): Add missing space in string literal.
	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
	(get_constraint_for_component_ref): Likewise.
	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
	* tree-outof-ssa.c (insert_partition_copy_on_edge): Likewise.
	* lra-constraints.c (process_alt_operands): Likewise.
	* ipa-inline.c (inline_small_functions): Likewise.
	* tree-ssa-sccvn.c (visit_reference_op_store): Likewise.
	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Likewise.
	* trans-mem.c (diagnose_tm_1_op): Likewise.
	* omp-grid.c (grid_find_single_omp_among_assignments): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
c/
	* c-parser.c (c_parser_oacc_declare): Add missing space in
	diagnostics.
fortran/
	* trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.


	Jakub

Comments

Jeff Law Feb. 13, 2017, 9:54 p.m. UTC | #1
On 02/13/2017 12:42 PM, Jakub Jelinek wrote:
> Hi!
>
> While looking at PR79475 (already fixed), I wrote a small scriptlet
> #!/bin/awk -f
> /^[[:blank:]]*"[^[:blank:]]/ {
>   if (last)
>     {
>       print last
>       print
>     }
> }
> {
>   last = ""
> }
> /[^[:blank:]]"[[:blank:]]*\\?$/ {
>   if ($0 ~ /\\[tnv]"[[:blank:]]*\\?$/)
>     last = ""
>   else
>     last = $0
> }
> to look for possible issues like
> 	"something"
> 	"and something"
> where there probably is supposed to be a space in between.  It shows
> various false positives (especially in the spec handling stuff) and while
> it handles
> 	"something\n"
> 	"something else"
> it doesn't handle
> 	"something"
> 	"\nsomething else"
> but in any case the false positive ratio was small enough that I could
> easily look for actual bugs.  This patch fixes various of these
> in the middle end as well as C and fortran FEs.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
>
> 	* cprop.c (cprop_jump): Add missing space in string literal.
> 	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
> 	(get_constraint_for_component_ref): Likewise.
> 	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
> 	* tree-outof-ssa.c (insert_partition_copy_on_edge): Likewise.
> 	* lra-constraints.c (process_alt_operands): Likewise.
> 	* ipa-inline.c (inline_small_functions): Likewise.
> 	* tree-ssa-sccvn.c (visit_reference_op_store): Likewise.
> 	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Likewise.
> 	* trans-mem.c (diagnose_tm_1_op): Likewise.
> 	* omp-grid.c (grid_find_single_omp_among_assignments): Likewise.
> 	(grid_parallel_clauses_gridifiable): Likewise.
> c/
> 	* c-parser.c (c_parser_oacc_declare): Add missing space in
> 	diagnostics.
> fortran/
> 	* trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.
OK.
jeff
diff mbox

Patch

--- gcc/cprop.c.jj	2017-02-07 18:45:12.000000000 +0100
+++ gcc/cprop.c	2017-02-13 11:47:26.122780219 +0100
@@ -972,7 +972,7 @@  cprop_jump (basic_block bb, rtx_insn *se
   if (dump_file != NULL)
     {
       fprintf (dump_file,
-	       "GLOBAL CONST-PROP: Replacing reg %d in jump_insn %d with"
+	       "GLOBAL CONST-PROP: Replacing reg %d in jump_insn %d with "
 	       "constant ", REGNO (from), INSN_UID (jump));
       print_rtl (dump_file, src);
       fprintf (dump_file, "\n");
--- gcc/tree-ssa-structalias.c.jj	2017-01-01 12:45:38.000000000 +0100
+++ gcc/tree-ssa-structalias.c	2017-02-13 11:46:31.354548069 +0100
@@ -2564,7 +2564,7 @@  rewrite_constraints (constraint_graph_t
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 
-	      fprintf (dump_file, "%s is a non-pointer variable,"
+	      fprintf (dump_file, "%s is a non-pointer variable, "
 		       "ignoring constraint:",
 		       get_varinfo (lhs.var)->name);
 	      dump_constraint (dump_file, c);
@@ -2579,7 +2579,7 @@  rewrite_constraints (constraint_graph_t
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
 
-	      fprintf (dump_file, "%s is a non-pointer variable,"
+	      fprintf (dump_file, "%s is a non-pointer variable, "
 		       "ignoring constraint:",
 		       get_varinfo (rhs.var)->name);
 	      dump_constraint (dump_file, c);
@@ -3295,7 +3295,7 @@  get_constraint_for_component_ref (tree t
       else if (bitmaxsize == 0)
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
-	    fprintf (dump_file, "Access to zero-sized part of variable,"
+	    fprintf (dump_file, "Access to zero-sized part of variable, "
 		     "ignoring\n");
 	}
       else
--- gcc/df-core.c.jj	2017-01-01 12:45:38.000000000 +0100
+++ gcc/df-core.c	2017-02-13 11:46:58.707164586 +0100
@@ -1064,7 +1064,7 @@  df_worklist_dataflow_doublequeue (struct
   /* Dump statistics. */
   if (dump_file)
     fprintf (dump_file, "df_worklist_dataflow_doublequeue:"
-	     "n_basic_blocks %d n_edges %d"
+	     " n_basic_blocks %d n_edges %d"
 	     " count %d (%5.2g)\n",
 	     n_basic_blocks_for_fn (cfun), n_edges_for_fn (cfun),
 	     dcount, dcount / (float)n_basic_blocks_for_fn (cfun));
--- gcc/tree-outof-ssa.c.jj	2017-01-01 12:45:36.000000000 +0100
+++ gcc/tree-outof-ssa.c	2017-02-13 11:42:55.241531916 +0100
@@ -242,7 +242,7 @@  insert_partition_copy_on_edge (edge e, i
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file,
-	       "Inserting a partition copy on edge BB%d->BB%d :"
+	       "Inserting a partition copy on edge BB%d->BB%d : "
 	       "PART.%d = PART.%d",
 	       e->src->index,
 	       e->dest->index, dest, src);
--- gcc/lra-constraints.c.jj	2017-01-30 09:31:48.000000000 +0100
+++ gcc/lra-constraints.c	2017-02-13 11:50:31.671178832 +0100
@@ -2848,7 +2848,7 @@  process_alt_operands (int only_alternati
 	      if (lra_dump_file != NULL)
 		fprintf
 		  (lra_dump_file,
-		   "            %d Matched conflict early clobber reloads:"
+		   "            %d Matched conflict early clobber reloads: "
 		   "reject--\n",
 		   i);
 	      reject--;
--- gcc/ipa-inline.c.jj	2017-01-01 12:45:36.000000000 +0100
+++ gcc/ipa-inline.c	2017-02-13 11:43:37.039970356 +0100
@@ -2052,7 +2052,7 @@  inline_small_functions (void)
       if (dump_file)
 	{
 	  fprintf (dump_file,
-		   " Inlined into %s which now has time %i and size %i,"
+		   " Inlined into %s which now has time %i and size %i, "
 		   "net change of %+i.\n",
 		   edge->caller->name (),
 		   inline_summaries->get (edge->caller)->time,
--- gcc/tree-ssa-sccvn.c.jj	2017-01-19 16:58:17.000000000 +0100
+++ gcc/tree-ssa-sccvn.c	2017-02-13 11:42:09.938140565 +0100
@@ -3684,7 +3684,7 @@  visit_reference_op_store (tree lhs, tree
 	 number of the vuse it came from.  */
 
       if (dump_file && (dump_flags & TDF_DETAILS))
-	fprintf (dump_file, "Store matched earlier value,"
+	fprintf (dump_file, "Store matched earlier value, "
 		 "value numbering store vdefs to matching vuses.\n");
 
       changed |= set_ssa_val_to (vdef, SSA_VAL (vuse));
--- gcc/cgraph.c.jj	2017-02-03 17:08:58.000000000 +0100
+++ gcc/cgraph.c	2017-02-13 11:51:01.768756864 +0100
@@ -1314,7 +1314,7 @@  cgraph_edge::redirect_call_stmt_to_calle
 	{
 	  if (dump_file)
 	    fprintf (dump_file,
-		     "Expanding speculative call of %s/%i -> %s/%i count:"
+		     "Expanding speculative call of %s/%i -> %s/%i count: "
 		     "%" PRId64"\n",
 		     xstrdup_for_dump (e->caller->name ()),
 		     e->caller->order,
--- gcc/trans-mem.c.jj	2017-01-01 12:45:38.000000000 +0100
+++ gcc/trans-mem.c	2017-02-13 11:49:40.038902716 +0100
@@ -620,7 +620,7 @@  diagnose_tm_1_op (tree *tp, int *walk_su
 		  "invalid use of volatile lvalue inside transaction");
       else if (d->func_flags & DIAG_TM_SAFE)
 	error_at (gimple_location (d->stmt),
-		  "invalid use of volatile lvalue inside %<transaction_safe%>"
+		  "invalid use of volatile lvalue inside %<transaction_safe%> "
 		  "function");
     }
 
--- gcc/omp-grid.c.jj	2017-01-01 12:45:38.000000000 +0100
+++ gcc/omp-grid.c	2017-02-13 11:45:54.348066900 +0100
@@ -232,7 +232,7 @@  grid_find_single_omp_among_assignments (
       if (!ret && dump_enabled_p ())
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, grid->target_loc,
 			 GRID_MISSED_MSG_PREFIX "%s construct does not contain"
-			 "any other OpenMP construct\n", name);
+			 " any other OpenMP construct\n", name);
       return ret;
     }
   else
@@ -309,7 +309,7 @@  grid_parallel_clauses_gridifiable (gomp_
 	  if (dump_enabled_p ())
 	    {
 	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc,
-			       GRID_MISSED_MSG_PREFIX "a reduction clause"
+			       GRID_MISSED_MSG_PREFIX "a reduction clause "
 			       "is present\n ");
 	      dump_printf_loc (MSG_NOTE, gimple_location (par),
 			       "Parallel construct has a reduction clause\n");
--- gcc/c/c-parser.c.jj	2017-02-09 23:01:48.000000000 +0100
+++ gcc/c/c-parser.c	2017-02-13 11:44:50.636960129 +0100
@@ -13817,7 +13817,7 @@  c_parser_oacc_declare (c_parser *parser)
 	       || !DECL_EXTERNAL (decl)))
 	    {
 	      error_at (loc,
-			"%qD must be a global variable in"
+			"%qD must be a global variable in "
 			"%<#pragma acc declare link%>",
 			decl);
 	      error = true;
--- gcc/fortran/trans-expr.c.jj	2017-01-19 16:58:24.000000000 +0100
+++ gcc/fortran/trans-expr.c	2017-02-13 11:48:34.760817914 +0100
@@ -2277,7 +2277,7 @@  gfc_conv_substring (gfc_se * se, gfc_ref
 	msg = xasprintf ("Substring out of bounds: lower bound (%%ld) of '%s' "
 			 "is less than one", name);
       else
-	msg = xasprintf ("Substring out of bounds: lower bound (%%ld)"
+	msg = xasprintf ("Substring out of bounds: lower bound (%%ld) "
 			 "is less than one");
       gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
 			       fold_convert (long_integer_type_node,