[mainline] C++ PATCH: fix confusing pretty-printing in C++/11357

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Sep 17 17:58:00 GMT 2003


This fixes a confusion in the diagnostic displayed in C++/11357.

Bootstrapped and regtested on an i686-pc-linux-gnu.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.1076
diff -p -r2.1076 ChangeLog
*** ChangeLog	17 Sep 2003 14:04:38 -0000	2.1076
--- ChangeLog	17 Sep 2003 17:54:47 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2003-09-17  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	PR c++/11357
+ 	* c-pretty-print.c (pp_c_floating_constant): Append
+ 	type-annotation to floating constants.
+ 
  2003-09-17  Daniel Jacobowitz  <drow@mvista.com>
  
  	* config/rs6000/sysv4.h (LIB_LINUX_SPEC): Make -pthread apply
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.26
diff -p -r1.26 c-pretty-print.c
*** c-pretty-print.c	7 Sep 2003 18:52:48 -0000	1.26
--- c-pretty-print.c	17 Sep 2003 17:54:47 -0000
*************** pp_c_enumeration_constant (c_pretty_prin
*** 805,817 ****
    return value_is_named;
  }
  
! /* Print out a REAL value.  */
  static inline void
  pp_c_floating_constant (c_pretty_printer *pp, tree r)
  {
    real_to_decimal (pp_buffer (pp)->digit_buffer, &TREE_REAL_CST (r),
  		   sizeof (pp_buffer (pp)->digit_buffer), 0, 1);
    pp_string (pp, pp_buffer(pp)->digit_buffer);
  }
  
  /* constant:
--- 805,822 ----
    return value_is_named;
  }
  
! /* Print out a REAL value as a decimal-floating-constant.  */
! 
  static inline void
  pp_c_floating_constant (c_pretty_printer *pp, tree r)
  {
    real_to_decimal (pp_buffer (pp)->digit_buffer, &TREE_REAL_CST (r),
  		   sizeof (pp_buffer (pp)->digit_buffer), 0, 1);
    pp_string (pp, pp_buffer(pp)->digit_buffer);
+   if (TREE_TYPE (r) == float_type_node)
+     pp_character (pp, 'f');
+   else if (TREE_TYPE (r) == long_double_type_node)
+     pp_character (pp, 'l');
  }
  
  /* constant:



More information about the Gcc-patches mailing list