[mainline] PATCH to diagnostic.[hc]

Gabriel Dos Reis gdr@integrable-solutions.net
Sun Jun 22 12:55:00 GMT 2003


This was suggested by Kaveh.

Bootstrapping.

-- Gaby

2003-06-22  Gabriel Dos Reis <gdr@integrable-solutions.net>

	* diagnostic.h (output_host_wide_integer): Declare.
	* diagnostic.c (output_long_long_decicaml): New function.
	(output_host_wide_integer): Likewise.
	(output_format): Use them.  Handle "%ll" and "%w".

Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.h,v
retrieving revision 1.59
diff -p -r1.59 diagnostic.h
*** diagnostic.h	13 Jun 2003 11:36:29 -0000	1.59
--- diagnostic.h	22 Jun 2003 07:36:21 -0000
*************** extern int output_space_left (const outp
*** 315,320 ****
--- 315,321 ----
  extern void output_append (output_buffer *, const char *, const char *);
  extern void output_add_character (output_buffer *, int);
  extern void output_decimal (output_buffer *, int);
+ extern void output_host_wide_integer (output_buffer *, HOST_WIDE_INT);
  extern void output_add_string (output_buffer *, const char *);
  extern void output_add_identifier (output_buffer *, tree);
  extern const char *output_finalize_message (output_buffer *);
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.116
diff -p -r1.116 diagnostic.c
*** diagnostic.c	20 Jun 2003 22:56:35 -0000	1.116
--- diagnostic.c	22 Jun 2003 07:36:21 -0000
*************** output_long_hexadecimal (output_buffer *
*** 335,340 ****
--- 335,352 ----
  }
  
  static inline void
+ output_long_long_decimal (output_buffer *buffer, long long int i)
+ {
+   output_formatted_scalar (buffer, "%lld", i);
+ }
+ 
+ void
+ output_host_wide_integer (output_buffer *buffer, HOST_WIDE_INT i)
+ {
+   output_formatted_scalar (buffer, HOST_WIDE_INT_PRINT_DEC, i);
+ }
+ 
+ static inline void
  output_pointer (output_buffer *buffer, void *p)
  {
    output_formatted_scalar (buffer, HOST_PTR_PRINTF, p);
*************** output_buffer_to_stream (output_buffer *
*** 457,462 ****
--- 469,476 ----
     %o: unsigned integer in base eight.
     %x: unsigned integer in base sixteen.
     %ld, %li, %lo, %lu, %lx: long versions of the above.
+    %ll: long long int.
+    %w: and integer of type HOST_WIDE_INT.
     %c: character.
     %s: string.
     %p: pointer.
*************** output_format (output_buffer *buffer, te
*** 542,547 ****
--- 556,570 ----
                (buffer, va_arg (*text->args_ptr, unsigned int));
  	  break;
  
+         case 'l':
+           if (long_integer)
+             output_long_long_decimal
+               (buffer, va_arg (*text->args_ptr, long long));
+           else
+             /* Sould not happen. */
+             abort();
+           break;
+ 
  	case 'm':
  	  output_add_string (buffer, xstrerror (text->err_no));
  	  break;
*************** output_format (output_buffer *buffer, te
*** 574,579 ****
--- 597,607 ----
  	    output_append (buffer, s, s + n);
  	  }
  	  break;
+ 
+         case 'w':
+           output_host_wide_integer
+             (buffer, va_arg (*text->args_ptr, HOST_WIDE_INT));
+           break;                                   
  
  	default:
  	  if (!buffer->format_decoder



More information about the Gcc-patches mailing list