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]
Other format: [Raw text]

RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W


Hi Guys,

  Gcc will issue a warning message if a source file contains a DOS
  end-of-file character (ctrl-Z).  The patch below silences this
  warning, unless the -W (extra warnings) switch is used.  This will
  allow source files created under DOS to be compiled without
  prejudice.

  May I apply this patch please ?

Cheers
        Nick

2002-05-08  Nick Clifton  <nickc@cambridge.redhat.com>

	* c-lex.c (c_lex): Ignore ctrl-Z character unless -W has been
	specified.

Index: gcc/c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.176
diff -c -3 -p -w -r1.176 c-lex.c
*** gcc/c-lex.c	6 May 2002 22:52:57 -0000	1.176
--- gcc/c-lex.c	8 May 2002 11:15:09 -0000
*************** c_lex (value)
*** 747,753 ****
      case CPP_OTHER:
        if (ISGRAPH (tok->val.c))
  	error ("stray '%c' in program", tok->val.c);
!       else
  	error ("stray '\\%o' in program", tok->val.c);
        goto retry;
        
--- 747,755 ----
      case CPP_OTHER:
        if (ISGRAPH (tok->val.c))
  	error ("stray '%c' in program", tok->val.c);
!       /* Ignore the DOS end-of-file character (ctrl-Z)
! 	 unless we are generating extra warnings.  */
!       else if (tok->val.c != '\032' || extra_warnings)
  	error ("stray '\\%o' in program", tok->val.c);
        goto retry;
        


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