aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-04-18 21:22:25 +0000
committerRichard Stallman <rms@gnu.org>1992-04-18 21:22:25 +0000
commit0dcd8ceed30eb9f1009fc5846df8cb70d03bd974 (patch)
treeca93e2d2db112a5f3f4c6dab11ca1484e44f9847 /gcc
parent6c94ce6718dda7c33126da4b11b9800d8399714e (diff)
downloadgcc-0dcd8ceed30eb9f1009fc5846df8cb70d03bd974.zip
gcc-0dcd8ceed30eb9f1009fc5846df8cb70d03bd974.tar.gz
gcc-0dcd8ceed30eb9f1009fc5846df8cb70d03bd974.tar.bz2
*** empty log message ***
From-SVN: r786
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-lex.c65
1 files changed, 16 insertions, 49 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 897cdec..e8759bc 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -353,57 +353,15 @@ static int
skip_white_space (c)
register int c;
{
-#if 0
- register int inside;
-#endif
+ static int newline_warning = 0;
for (;;)
{
switch (c)
{
- /* Don't recognize comments in cc1: all comments are removed by cpp,
- and cpp output can include / and * consecutively as operators. */
-#if 0
- case '/':
- c = getc (finput);
- if (c != '*')
- {
- ungetc (c, finput);
- return '/';
- }
-
- c = getc (finput);
-
- inside = 1;
- while (inside)
- {
- if (c == '*')
- {
- while (c == '*')
- c = getc (finput);
-
- if (c == '/')
- {
- inside = 0;
- c = getc (finput);
- }
- }
- else if (c == '\n')
- {
- lineno++;
- c = getc (finput);
- }
- else if (c == EOF)
- {
- error ("unterminated comment");
- break;
- }
- else
- c = getc (finput);
- }
-
- break;
-#endif
+ /* We don't recognize comments here, because
+ cpp output can include / and * consecutively as operators.
+ Also, there's no need, since cpp removes all comments. */
case '\n':
c = check_newline ();
@@ -412,14 +370,23 @@ skip_white_space (c)
case ' ':
case '\t':
case '\f':
-#if 0 /* ANSI says no. */
- case '\r':
-#endif
case '\v':
case '\b':
c = getc (finput);
break;
+ case '\r':
+ /* ANSI C says the effects of a carriage return in a source file
+ are undefined. */
+ if (pedantic && !newline_warning)
+ {
+ warning ("carriage return in source file");
+ warning ("(we only warn about the first carriage return)");
+ newline_warning = 1;
+ }
+ c = getc (finput);
+ break;
+
case '\\':
c = getc (finput);
if (c == '\n')