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]

Re: [PATCH] Clean up FIXME in c-lex.c


Andrew Pinski wrote:

On Mar 9, 2005, at 5:47 PM, Jon Grimm wrote:


+ pedwarn ("floating constant exceeds range of %<%T%>", type);


You might want to use %qT instead which does the same thing as above
and is the style used in the rest of GCC.

-- Pinski



OK. Thanks!


A FIXME in c-lex.c reads:
'/* FIXME: make %T work in error/warning, then we don't need type_name.  */'

Now, %T seems to be supported in warning/error/etc.. (e.g. used in c-format.c) so seems like this could be fixed up.

Bootstrapped and tested on ppc64-unknown-linux Explictly tested via gcc.dg/float-range-1.c

I don't have write access, so if it looks correct, please commit.

Thanks,
Jon

2005-03-09 Jon Grimm <jgrimm2@us.ibm.com>

      * c-lex.c (interpret_float): Remove type_name, instead use %qT
   in warning.





Index: gcc/c-lex.c
===================================================================
RCS file: /home/jgrimm/gcc-cvs/gcc/gcc/c-lex.c,v
retrieving revision 1.242
diff -u -p -r1.242 c-lex.c
--- gcc/c-lex.c	27 Oct 2004 17:24:20 -0000	1.242
+++ gcc/c-lex.c	9 Mar 2005 17:24:47 -0000
@@ -637,25 +637,14 @@ interpret_float (const cpp_token *token,
  REAL_VALUE_TYPE real;
  char *copy;
  size_t copylen;
-  const char *type_name;

-  /* FIXME: make %T work in error/warning, then we don't need type_name.  */
  if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
-    {
      type = long_double_type_node;
-      type_name = "long double";
-    }
  else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL
	   || flag_single_precision_constant)
-    {
      type = float_type_node;
-      type_name = "float";
-    }
  else
-    {
      type = double_type_node;
-      type_name = "double";
-    }

  /* Copy the constant to a nul-terminated buffer.  If the constant
     has any suffixes, cut them off; REAL_VALUE_ATOF/ REAL_VALUE_HTOF
@@ -681,7 +670,7 @@ interpret_float (const cpp_token *token,
     appropriate for this to be a mandatory pedwarn rather than
     conditioned on -pedantic.  */
  if (REAL_VALUE_ISINF (real) && pedantic)
-    pedwarn ("floating constant exceeds range of %<%s%>", type_name);
+    pedwarn ("floating constant exceeds range of %<%qT%>", type);

  /* Create a node with determined type and value.  */
  value = build_real (type, real);


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