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]

C patch: accept \r


When Zack removed support for \r from the frontends because cpp
doesn't produce it, suddenly I was unable to compile preprocessed
testcases from customers on CR-using hosts.  This patch seems harmless.

2000-09-22  Jason Merrill  <jason@redhat.com>

	* c-lex.c (skip_white_space): Just treat CRs as horizontal whitespace.

*** c-lex.c.~1~	Thu Sep 21 15:02:08 2000
--- c-lex.c	Thu Sep 21 15:02:09 2000
*************** skip_white_space (c)
*** 310,317 ****
      {
        switch (c)
  	{
! 	  /* There is no need to process comments, backslash-newline,
!              or \r here.  None can occur in the output of cpp.  */
  
  	case '\n':
  	  if (linemode)
--- 310,318 ----
      {
        switch (c)
  	{
! 	  /* There is no need to process comments or backslash-newline
!              here.  None can occur in the output of cpp.  Do handle \r
! 	     in case someone sent us a .i file.  */
  
  	case '\n':
  	  if (linemode)
*************** skip_white_space (c)
*** 322,333 ****
  	  c = check_newline ();
  	  break;
  
  	  /* Per C99, horizontal whitespace is just these four characters.  */
  	case ' ':
  	case '\t':
  	case '\f':
  	case '\v':
! 	    c = getch ();
  	  break;
  
  	case '\\':
--- 323,335 ----
  	  c = check_newline ();
  	  break;
  
+ 	case '\r':
  	  /* Per C99, horizontal whitespace is just these four characters.  */
  	case ' ':
  	case '\t':
  	case '\f':
  	case '\v':
! 	  c = getch ();
  	  break;
  
  	case '\\':
*************** c_lex (value)
*** 1503,1511 ****
        case '\t':
        case '\f':
        case '\v':
! 	  c = getch ();
  	break;
  
        case '\n':
  	c = skip_white_space (c);
        default:
--- 1505,1514 ----
        case '\t':
        case '\f':
        case '\v':
! 	c = getch ();
  	break;
  
+       case '\r':
        case '\n':
  	c = skip_white_space (c);
        default:

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