cpplib.c patch

Fred Fish fnf@ninemoons.com
Sat Sep 6 07:52:00 GMT 1997


cpplib.c fails to compile with compilers that are excessively
picky about interchanging "unsigned char *" with "char *".

-Fred

Fri Sep  5 23:46:49 1997  Fred Fish  <fnf@ninemoons.com>

	* cpplib.c (quote_string): Cast first arg of sprintf call
	from "unsigned char *" to "char *".
	(output_line_command): Ditto.
	(macroexpand): Ditto.
	(do_line): Cast atoi arg from "unsigned char *" to "char *".

Index: cpplib.c
===================================================================
RCS file: /cvsroot/gg/egcs/gcc/cpplib.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 cpplib.c
*** cpplib.c	1997/09/04 04:43:45	1.1.1.1
--- cpplib.c	1997/09/06 07:04:38
***************
*** 510,516 ****
  	  CPP_PUTC_Q (pfile, c);
  	else
  	  {
! 	    sprintf (CPP_PWRITTEN (pfile), "\\%03o", c);
  	    CPP_ADJUST_WRITTEN (pfile, 4);
  	  }
  	break;
--- 510,516 ----
  	  CPP_PUTC_Q (pfile, c);
  	else
  	  {
! 	    sprintf ((char *) CPP_PWRITTEN (pfile), "\\%03o", c);
  	    CPP_ADJUST_WRITTEN (pfile, 4);
  	  }
  	break;
***************
*** 2133,2139 ****
      CPP_PUTS_Q (pfile, sharp_line, sizeof(sharp_line)-1);
    }
  
!   sprintf (CPP_PWRITTEN (pfile), "%d ", line);
    CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
  
    quote_string (pfile, ip->nominal_fname); 
--- 2133,2139 ----
      CPP_PUTS_Q (pfile, sharp_line, sizeof(sharp_line)-1);
    }
  
!   sprintf ((char *) CPP_PWRITTEN (pfile), "%d ", line);
    CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
  
    quote_string (pfile, ip->nominal_fname); 
***************
*** 2809,2815 ****
  		      else
  			{
  			  CPP_RESERVE (pfile, 4);
! 			  sprintf (CPP_PWRITTEN (pfile), "\\%03o",
  				   (unsigned int) c);
  			  CPP_ADJUST_WRITTEN (pfile, 4);
  			}
--- 2809,2815 ----
  		      else
  			{
  			  CPP_RESERVE (pfile, 4);
! 			  sprintf ((char *) CPP_PWRITTEN (pfile), "\\%03o",
  				   (unsigned int) c);
  			  CPP_ADJUST_WRITTEN (pfile, 4);
  			}
***************
*** 3728,3734 ****
    /* The Newline at the end of this line remains to be processed.
       To put the next line at the specified line number,
       we must store a line number now that is one less.  */
!   new_lineno = atoi (pfile->token_buffer + old_written) - 1;
    CPP_SET_WRITTEN (pfile, old_written);
  
    /* NEW_LINENO is one less than the actual line number here.  */
--- 3728,3734 ----
    /* The Newline at the end of this line remains to be processed.
       To put the next line at the specified line number,
       we must store a line number now that is one less.  */
!   new_lineno = atoi ((char *) pfile->token_buffer + old_written) - 1;
    CPP_SET_WRITTEN (pfile, old_written);
  
    /* NEW_LINENO is one less than the actual line number here.  */



More information about the Gcc-bugs mailing list