This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR middle-end/14521: Inconsistent warning quoting


The following is my attempt to resolve PR middle-end/14521 on mainline
by using the new quoting machinery.  This patch replaces the remaining
instances of '%F' and '%D' in the middle-end to use %qF and %qD instead.

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.

Ok for mainline?  If someone could confirm this is the correct fix, I'm
happy to approve these changes to the middle-end.  I'd also appreciate
thoughts on how best/whether to fix this PR for the 3.4 branch.



2004-10-31  Roger Sayle  <roger@eyesopen.com>

	PR middle-end/14521
	* tree-inline.c (inline_forbidden_p_1): Use %qF instead of '%F'
	for consistent quoting in diagnostic messages.
	(expand_call_inline): Likewise.
	* tree-optimize.c (tree_rest_of_compilation): Likewise.
	* tree-ssa.c (warn_uninitialized_var): Likewise.
	(warn_uninitialized_phi): Likewise.


Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 tree-inline.c
*** tree-inline.c	22 Oct 2004 17:05:06 -0000	1.147
--- tree-inline.c	31 Oct 2004 16:52:38 -0000
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 941,947 ****
  	  && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction '%F' can never be inlined because it uses "
  		 "alloca (override using the always_inline attribute)");
  	  return node;
  	}
--- 941,947 ----
  	  && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction %qF can never be inlined because it uses "
  		 "alloca (override using the always_inline attribute)");
  	  return node;
  	}
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 953,959 ****
        if (setjmp_call_p (t))
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction '%F' can never be inlined because it uses setjmp");
  	  return node;
  	}

--- 953,959 ----
        if (setjmp_call_p (t))
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction %qF can never be inlined because it uses setjmp");
  	  return node;
  	}

*************** inline_forbidden_p_1 (tree *nodep, int *
*** 967,973 ****
  	  case BUILT_IN_NEXT_ARG:
  	  case BUILT_IN_VA_END:
  	    inline_forbidden_reason
! 	      = N_("%Jfunction '%F' can never be inlined because it "
  		   "uses variable argument lists");
  	    return node;

--- 967,973 ----
  	  case BUILT_IN_NEXT_ARG:
  	  case BUILT_IN_VA_END:
  	    inline_forbidden_reason
! 	      = N_("%Jfunction %qF can never be inlined because it "
  		   "uses variable argument lists");
  	    return node;

*************** inline_forbidden_p_1 (tree *nodep, int *
*** 978,991 ****
  	       function calling __builtin_longjmp to be inlined into the
  	       function calling __builtin_setjmp, Things will Go Awry.  */
  	    inline_forbidden_reason
! 	      = N_("%Jfunction '%F' can never be inlined because "
  		   "it uses setjmp-longjmp exception handling");
  	    return node;

  	  case BUILT_IN_NONLOCAL_GOTO:
  	    /* Similarly.  */
  	    inline_forbidden_reason
! 	      = N_("%Jfunction '%F' can never be inlined because "
  		   "it uses non-local goto");
  	    return node;

--- 978,991 ----
  	       function calling __builtin_longjmp to be inlined into the
  	       function calling __builtin_setjmp, Things will Go Awry.  */
  	    inline_forbidden_reason
! 	      = N_("%Jfunction %qF can never be inlined because "
  		   "it uses setjmp-longjmp exception handling");
  	    return node;

  	  case BUILT_IN_NONLOCAL_GOTO:
  	    /* Similarly.  */
  	    inline_forbidden_reason
! 	      = N_("%Jfunction %qF can never be inlined because "
  		   "it uses non-local goto");
  	    return node;

*************** inline_forbidden_p_1 (tree *nodep, int *
*** 1004,1010 ****
        if (TREE_CODE (t) != LABEL_DECL)
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction '%F' can never be inlined "
  		 "because it contains a computed goto");
  	  return node;
  	}
--- 1004,1010 ----
        if (TREE_CODE (t) != LABEL_DECL)
  	{
  	  inline_forbidden_reason
! 	    = N_("%Jfunction %qF can never be inlined "
  		 "because it contains a computed goto");
  	  return node;
  	}
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 1018,1024 ****
  	     because we cannot remap the destination label used in the
  	     function that is performing the non-local goto.  */
  	  inline_forbidden_reason
! 	    = N_("%Jfunction '%F' can never be inlined "
  		 "because it receives a non-local goto");
  	  return node;
  	}
--- 1018,1024 ----
  	     because we cannot remap the destination label used in the
  	     function that is performing the non-local goto.  */
  	  inline_forbidden_reason
! 	    = N_("%Jfunction %qF can never be inlined "
  		 "because it receives a non-local goto");
  	  return node;
  	}
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 1040,1046 ****
  	if (variably_modified_type_p (TREE_TYPE (t), NULL))
  	  {
  	    inline_forbidden_reason
! 	      = N_("%Jfunction '%F' can never be inlined "
  		   "because it uses variable sized variables");
  	    return node;
  	  }
--- 1040,1046 ----
  	if (variably_modified_type_p (TREE_TYPE (t), NULL))
  	  {
  	    inline_forbidden_reason
! 	      = N_("%Jfunction %qF can never be inlined "
  		   "because it uses variable sized variables");
  	    return node;
  	  }
*************** expand_call_inline (tree *tp, int *walk_
*** 1471,1477 ****
      {
        if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
  	{
! 	  sorry ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
  	  sorry ("called from here");
  	}
        else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
--- 1471,1477 ----
      {
        if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
  	{
! 	  sorry ("%Jinlining failed in call to %qF: %s", fn, fn, reason);
  	  sorry ("called from here");
  	}
        else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
*************** expand_call_inline (tree *tp, int *walk_
*** 1479,1485 ****
  	       && strlen (reason)
  	       && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn)))
  	{
! 	  warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
  	  warning ("called from here");
  	}
        goto egress;
--- 1479,1485 ----
  	       && strlen (reason)
  	       && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn)))
  	{
! 	  warning ("%Jinlining failed in call to %qF: %s", fn, fn, reason);
  	  warning ("called from here");
  	}
        goto egress;
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.58
diff -c -3 -p -r2.58 tree-optimize.c
*** tree-optimize.c	27 Oct 2004 17:45:20 -0000	2.58
--- tree-optimize.c	31 Oct 2004 16:52:38 -0000
*************** tree_rest_of_compilation (tree fndecl)
*** 683,692 ****
  	    = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));

  	  if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
! 	    warning ("%Jsize of return value of '%D' is %u bytes",
                       fndecl, fndecl, size_as_int);
  	  else
! 	    warning ("%Jsize of return value of '%D' is larger than %wd bytes",
                       fndecl, fndecl, larger_than_size);
  	}
      }
--- 683,692 ----
  	    = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));

  	  if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
! 	    warning ("%Jsize of return value of %qD is %u bytes",
                       fndecl, fndecl, size_as_int);
  	  else
! 	    warning ("%Jsize of return value of %qD is larger than %wd bytes",
                       fndecl, fndecl, larger_than_size);
  	}
      }
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.52
diff -c -3 -p -r2.52 tree-ssa.c
*** tree-ssa.c	29 Oct 2004 08:41:08 -0000	2.52
--- tree-ssa.c	31 Oct 2004 16:52:38 -0000
*************** warn_uninitialized_var (tree *tp, int *w
*** 1388,1394 ****
    /* We only do data flow with SSA_NAMEs, so that's all we can warn about.  */
    if (TREE_CODE (t) == SSA_NAME)
      {
!       warn_uninit (t, "%H'%D' is used uninitialized in this function", locus);
        *walk_subtrees = 0;
      }
    else if (IS_TYPE_OR_DECL_P (t))
--- 1388,1394 ----
    /* We only do data flow with SSA_NAMEs, so that's all we can warn about.  */
    if (TREE_CODE (t) == SSA_NAME)
      {
!       warn_uninit (t, "%H%qD is used uninitialized in this function", locus);
        *walk_subtrees = 0;
      }
    else if (IS_TYPE_OR_DECL_P (t))
*************** warn_uninitialized_phi (tree phi)
*** 1413,1419 ****
      {
        tree op = PHI_ARG_DEF (phi, i);
        if (TREE_CODE (op) == SSA_NAME)
! 	warn_uninit (op, "%H'%D' may be used uninitialized in this function",
  		     NULL);
      }
  }
--- 1413,1419 ----
      {
        tree op = PHI_ARG_DEF (phi, i);
        if (TREE_CODE (op) == SSA_NAME)
! 	warn_uninit (op, "%H%qD may be used uninitialized in this function",
  		     NULL);
      }
  }


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]