[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    [mainline] PATCH to diagnostic.[hc]
From:       gcc () integrable-solutions ! net
Date:       2003-04-30 12:56:02
[Download RAW message or body]


This adds support for the %p format specifier. 

Booststrapped and tested on an i686-pc-linux-gnu.  No regression.

-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.17642
diff -p -r1.17642 ChangeLog
*** ChangeLog	30 Apr 2003 10:03:24 -0000	1.17642
--- ChangeLog	30 Apr 2003 12:53:26 -0000
***************
*** 1,3 ****
--- 1,16 ----
+ 2003-04-30  Gabriel Dos Reis <gdr@integrable-solutions.net>
+ 
+ 	* diagnostic.h (output_formatted_scalar): Tweak.
+ 	* diagnostic.c (output_long_decimal): Likewise.
+ 	(output_unsigned_decimal): Likewise.
+ 	(output_long_unsigned_decimal): Likewise.
+ 	(output_octal): Likewise.
+ 	(output_long_octal): Likewise.
+ 	(output_hexadecimal): Likewise.
+ 	(output_long_hexadecimal): Likewise.
+ 	(output_pointer): New function.
+ 	(output_format): Use it.  Recognize "%p" format specifier.
+ 
  2003-04-30  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
  
  	* function.c (purge_addressof_1): Postpone insn in fewer cases.
Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.h,v
retrieving revision 1.52
diff -p -r1.52 diagnostic.h
*** diagnostic.h	12 Feb 2003 01:01:19 -0000	1.52
--- diagnostic.h	30 Apr 2003 12:53:26 -0000
*************** struct output_buffer
*** 160,169 ****
  /* True if BUFFER is in line-wrapping mode.  */
  #define output_is_line_wrapping(BUFFER) (output_line_cutoff (BUFFER) > 0)
  
! #define output_formatted_scalar(BUFFER, FORMAT, INTEGER)	\
    do								\
      {								\
!       sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER);	\
        output_add_string (BUFFER, (BUFFER)->digit_buffer);	\
      }								\
    while (0)
--- 160,169 ----
  /* True if BUFFER is in line-wrapping mode.  */
  #define output_is_line_wrapping(BUFFER) (output_line_cutoff (BUFFER) > 0)
  
! #define output_formatted_scalar(BUFFER, FORMAT, SCALAR)	\
    do								\
      {								\
!       sprintf ((BUFFER)->digit_buffer, FORMAT, SCALAR);	\
        output_add_string (BUFFER, (BUFFER)->digit_buffer);	\
      }								\
    while (0)
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.103
diff -p -r1.103 diagnostic.c
*** diagnostic.c	12 Feb 2003 01:01:16 -0000	1.103
--- diagnostic.c	30 Apr 2003 12:53:26 -0000
*************** output_decimal (buffer, i)
*** 307,368 ****
    output_formatted_scalar (buffer, "%d", i);
  }
  
! static void
! output_long_decimal (buffer, i)
!      output_buffer *buffer;
!      long int i;
  {
    output_formatted_scalar (buffer, "%ld", i);
  }
  
! static void
! output_unsigned_decimal (buffer, i)
!      output_buffer *buffer;
!      unsigned int i;
  {
    output_formatted_scalar (buffer, "%u", i);
  }
  
! static void
! output_long_unsigned_decimal (buffer, i)
!      output_buffer *buffer;
!      long unsigned int i;
  {
    output_formatted_scalar (buffer, "%lu", i);
  }
  
! static void
! output_octal (buffer, i)
!      output_buffer *buffer;
!      unsigned int i;
  {
    output_formatted_scalar (buffer, "%o", i);
  }
  
! static void
! output_long_octal (buffer, i)
!      output_buffer *buffer;
!      unsigned long int i;
  {
    output_formatted_scalar (buffer, "%lo", i);
  }
  
! static void
! output_hexadecimal (buffer, i)
!      output_buffer *buffer;
!      unsigned int i;
  {
    output_formatted_scalar (buffer, "%x", i);
  }
  
! static void
! output_long_hexadecimal (buffer, i)
!      output_buffer *buffer;
!      unsigned long int i;
  {
    output_formatted_scalar (buffer, "%lx", i);
  }
  
  /* Append to BUFFER a string specified by its STARTING character
     and LENGTH.  */
  static void
--- 307,360 ----
    output_formatted_scalar (buffer, "%d", i);
  }
  
! static inline void
! output_long_decimal (output_buffer *buffer, long int i)
  {
    output_formatted_scalar (buffer, "%ld", i);
  }
  
! static inline void
! output_unsigned_decimal (output_buffer *buffer, unsigned int i)
  {
    output_formatted_scalar (buffer, "%u", i);
  }
  
! static inline void
! output_long_unsigned_decimal (output_buffer *buffer, long unsigned int i)
  {
    output_formatted_scalar (buffer, "%lu", i);
  }
  
! static inline void
! output_octal (output_buffer *buffer, unsigned int i)
  {
    output_formatted_scalar (buffer, "%o", i);
  }
  
! static inline void
! output_long_octal (output_buffer *buffer, long unsigned int i)
  {
    output_formatted_scalar (buffer, "%lo", i);
  }
  
! static inline void
! output_hexadecimal (output_buffer *buffer, unsigned int i)
  {
    output_formatted_scalar (buffer, "%x", i);
  }
  
! static inline void
! output_long_hexadecimal (output_buffer *buffer, long unsigned int i)
  {
    output_formatted_scalar (buffer, "%lx", i);
  }
  
+ static inline void
+ output_pointer (output_buffer *buffer, void *p)
+ {
+   output_formatted_scalar (buffer, "%p", p);
+ }
+ 
  /* Append to BUFFER a string specified by its STARTING character
     and LENGTH.  */
  static void
*************** output_buffer_to_stream (buffer)
*** 497,502 ****
--- 489,495 ----
     %ld, %li, %lo, %lu, %lx: long versions of the above.
     %c: character.
     %s: string.
+    %p: pointer.
     %%: `%'.
     %*.s: a substring the length of which is specified by an integer.
     %H: location_t.  */
*************** output_format (buffer, text)
*** 530,536 ****
  	}
  
        /* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %o, %s, %u,
!          %x, %.*s; %%.  And nothing else.  Front-ends should install
           printers to grok language specific format specifiers.  */
        switch (*text->format_spec)
  	{
--- 523,529 ----
  	}
  
        /* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %o, %s, %u,
!          %x, %p, %.*s; %%.  And nothing else.  Front-ends should install
           printers to grok language specific format specifiers.  */
        switch (*text->format_spec)
  	{
*************** output_format (buffer, text)
*** 557,562 ****
--- 550,559 ----
  	case 's':
  	  output_add_string (buffer, va_arg (*text->args_ptr, const char *));
  	  break;
+ 
+         case 'p':
+           output_pointer (buffer, va_arg (*text->args_ptr, void *));
+           break;
  
  	case 'u':
  	  if (long_integer)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic