This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W
- From: Andris Pavenis <pavenis at latnet dot lv>
- To: Nick Clifton <nickc at cambridge dot redhat dot com>, djgpp-workers at delorie dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 8 May 2002 16:27:29 +0300 (EEST)
- Subject: Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W
On 8 May 2002, Nick Clifton wrote:
> 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 ?
For DJGPP (i[3456]86-pc-msdosdjgpp) I tried to truncate input after
Ctrl-Z in gcc/cppfiles.c. ^Z is end-of-file for DOS anyway, so the
correct action should perhaps be ignoring rest of file.
Andris
>
> 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;
>
>
>