Formerly read.c.~40~

This commit is contained in:
Roland McGrath 1992-10-25 03:24:24 +00:00
parent 8b591a8b90
commit cff0af8d6d

40
read.c
View file

@ -239,9 +239,10 @@ read_makefile (filename, type)
#define record_waiting_files() \ #define record_waiting_files() \
do \ do \
{ \ { \
record_files (filenames, pattern, pattern_percent, deps, \ if (filenames != 0) \
commands_started, commands, commands_idx, \ record_files (filenames, pattern, pattern_percent, deps, \
two_colon, filename, lineno, type != 1); \ commands_started, commands, commands_idx, \
two_colon, filename, lineno, type != 1); \
filenames = 0; \ filenames = 0; \
commands_idx = 0; \ commands_idx = 0; \
pattern = 0; \ pattern = 0; \
@ -353,13 +354,11 @@ read_makefile (filename, type)
{ {
int i = conditional_line (p, filename, lineno); int i = conditional_line (p, filename, lineno);
if (i >= 0) if (i >= 0)
{ ignoring = i;
ignoring = i;
continue;
}
else else
makefile_fatal (filename, lineno, makefile_fatal (filename, lineno,
"invalid syntax in conditional"); "invalid syntax in conditional");
continue;
} }
else if (word1eq ("endef", 5)) else if (word1eq ("endef", 5))
{ {
@ -367,6 +366,7 @@ read_makefile (filename, type)
in_ignored_define = 0; in_ignored_define = 0;
else else
makefile_fatal (filename, lineno, "extraneous `endef'"); makefile_fatal (filename, lineno, "extraneous `endef'");
continue;
} }
else if (word1eq ("define", 6)) else if (word1eq ("define", 6))
{ {
@ -378,11 +378,13 @@ read_makefile (filename, type)
p = end_of_token (p2); p = end_of_token (p2);
lineno = do_define (p2, p - p2, o_file, lineno = do_define (p2, p - p2, o_file,
lineno, infile, filename); lineno, infile, filename);
continue;
} }
continue;
} }
if (ignoring) if (ignoring)
continue; /* Ignore the line. */
;
else if (lb.buffer[0] == '\t') else if (lb.buffer[0] == '\t')
{ {
/* This line is a shell command. */ /* This line is a shell command. */
@ -405,6 +407,8 @@ read_makefile (filename, type)
bcopy (p, &commands[commands_idx], len); bcopy (p, &commands[commands_idx], len);
commands_idx += len; commands_idx += len;
commands[commands_idx++] = '\n'; commands[commands_idx++] = '\n';
continue;
} }
else if (word1eq ("override", 8)) else if (word1eq ("override", 8))
{ {
@ -422,7 +426,6 @@ read_makefile (filename, type)
else if (!try_variable_definition (p2, o_override)) else if (!try_variable_definition (p2, o_override))
makefile_error (filename, lineno, makefile_error (filename, lineno,
"Empty `override' directive"); "Empty `override' directive");
continue;
} }
else if (word1eq ("export", 6)) else if (word1eq ("export", 6))
{ {
@ -508,7 +511,6 @@ read_makefile (filename, type)
conditionals = save; conditionals = save;
reading_filename = filename; reading_filename = filename;
reading_lineno_ptr = &lineno; reading_lineno_ptr = &lineno;
continue;
} }
else if (word1eq ("vpath", 5)) else if (word1eq ("vpath", 5))
{ {
@ -538,11 +540,11 @@ read_makefile (filename, type)
free (pattern); free (pattern);
if (p != 0) if (p != 0)
free (p); free (p);
continue;
} }
#undef word1eq #undef word1eq
else if (try_variable_definition (p, o_file)) else if (try_variable_definition (p, o_file))
continue; /* This line has been dealt with. */
;
else else
{ {
/* This line describes some target files. */ /* This line describes some target files. */
@ -654,7 +656,14 @@ read_makefile (filename, type)
commands_idx += len; commands_idx += len;
commands[commands_idx++] = '\n'; commands[commands_idx++] = '\n';
} }
continue;
} }
/* We get here except in the case that we just read a rule line.
Record now the last rule we read, so following spurious
commands are properly diagnosed. */
record_waiting_files ();
} }
if (ignoring) if (ignoring)
@ -1324,9 +1333,8 @@ find_percent (pattern)
if (i % 2 == 0) if (i % 2 == 0)
/* All the backslashes quoted each other; the % was unquoted. */ /* All the backslashes quoted each other; the % was unquoted. */
return p; return p;
else
/* The % was quoted by a backslash. Look for another. */ /* The % was quoted by a backslash. Look for another. */
++p;
} }
else else
/* No backslash in sight. */ /* No backslash in sight. */