mirror of
https://github.com/mirror/make.git
synced 2025-01-14 22:30:39 +08:00
Ignore non-empty lines which become empty after variable expansion.
Don't choke on invalid pattern rules if we fail during makefile parsing. Don't dump core if a non-empty command becomes empty after expansion.
This commit is contained in:
parent
2c64fb221a
commit
3948640154
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
1998-10-13 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* job.c (new_job): If the command list resolves to empty (through
|
||||||
|
variable expansion, for example), stop early rather than running
|
||||||
|
start_waiting_job().
|
||||||
|
|
||||||
|
1998-10-12 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||||
|
|
||||||
|
* rule.c (print_rule_data_base): Ignore num_pattern_rules if it is
|
||||||
|
zero.
|
||||||
|
|
||||||
|
1998-10-09 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* read.c (read_makefile): Allow non-empty lines to expand to the
|
||||||
|
empty string after variable, etc., expansion, and be ignored.
|
||||||
|
|
||||||
1998-09-21 Paul D. Smith <psmith@gnu.org>
|
1998-09-21 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
* job.c (construct_command_argv_internal): Only add COMMAND.COM
|
* job.c (construct_command_argv_internal): Only add COMMAND.COM
|
||||||
|
15
job.c
15
job.c
@ -1274,11 +1274,16 @@ new_job (file)
|
|||||||
c->sh_batch_file = NULL;
|
c->sh_batch_file = NULL;
|
||||||
|
|
||||||
/* Fetch the first command line to be run. */
|
/* Fetch the first command line to be run. */
|
||||||
job_next_command (c);
|
if (job_next_command (c))
|
||||||
|
/* The job is now primed. Start it running. */
|
||||||
/* The job is now primed. Start it running.
|
(void)start_waiting_job (c);
|
||||||
(This will notice if there are in fact no commands.) */
|
else
|
||||||
(void)start_waiting_job (c);
|
{
|
||||||
|
/* There were no commands (variable expands to empty?). All done. */
|
||||||
|
c->file->update_status = 0;
|
||||||
|
notice_finished_file(c->file);
|
||||||
|
free_child (c);
|
||||||
|
}
|
||||||
|
|
||||||
if (job_slots == 1)
|
if (job_slots == 1)
|
||||||
/* Since there is only one job slot, make things run linearly.
|
/* Since there is only one job slot, make things run linearly.
|
||||||
|
33
read.c
33
read.c
@ -718,8 +718,7 @@ read_makefile (filename, flags)
|
|||||||
because there was no preceding target, and the line
|
because there was no preceding target, and the line
|
||||||
might have been usable as a variable definition.
|
might have been usable as a variable definition.
|
||||||
But now it is definitely lossage. */
|
But now it is definitely lossage. */
|
||||||
fatal (&fileinfo,
|
fatal(&fileinfo, "commands commence before first target");
|
||||||
"commands commence before first target");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -767,12 +766,10 @@ read_makefile (filename, flags)
|
|||||||
{
|
{
|
||||||
case w_eol:
|
case w_eol:
|
||||||
if (cmdleft != 0)
|
if (cmdleft != 0)
|
||||||
fatal (&fileinfo,
|
fatal(&fileinfo, "missing rule before commands");
|
||||||
"missing rule before commands");
|
/* This line contained something but turned out to be nothing
|
||||||
else
|
but whitespace (a comment?). */
|
||||||
/* This line contained a variable reference that
|
continue;
|
||||||
expanded to nothing but whitespace. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case w_colon:
|
case w_colon:
|
||||||
case w_dcolon:
|
case w_dcolon:
|
||||||
@ -835,11 +832,7 @@ read_makefile (filename, flags)
|
|||||||
|
|
||||||
wtype = get_next_mword(lb_next, NULL, &lb_next, &len);
|
wtype = get_next_mword(lb_next, NULL, &lb_next, &len);
|
||||||
if (wtype == w_eol)
|
if (wtype == w_eol)
|
||||||
/* There's no need to be ivory-tower about this: check for
|
break;
|
||||||
one of the most common bugs found in makefiles... */
|
|
||||||
fatal (&fileinfo, "missing separator%s",
|
|
||||||
strncmp(lb.buffer, " ", 8) ? ""
|
|
||||||
: " (did you mean TAB instead of 8 spaces?)");
|
|
||||||
|
|
||||||
p2 += strlen(p2);
|
p2 += strlen(p2);
|
||||||
*(p2++) = ' ';
|
*(p2++) = ' ';
|
||||||
@ -851,6 +844,20 @@ read_makefile (filename, flags)
|
|||||||
|
|
||||||
p2 = next_token (variable_buffer);
|
p2 = next_token (variable_buffer);
|
||||||
|
|
||||||
|
/* If the word we're looking at is EOL, see if there's _anything_
|
||||||
|
on the line. If not, a variable expanded to nothing, so ignore
|
||||||
|
it. If so, we can't parse this line so punt. */
|
||||||
|
if (wtype == w_eol)
|
||||||
|
{
|
||||||
|
if (*p2 != '\0')
|
||||||
|
/* There's no need to be ivory-tower about this: check for
|
||||||
|
one of the most common bugs found in makefiles... */
|
||||||
|
fatal (&fileinfo, "missing separator%s",
|
||||||
|
strncmp(lb.buffer, " ", 8) ? ""
|
||||||
|
: " (did you mean TAB instead of 8 spaces?)");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make the colon the end-of-string so we know where to stop
|
/* Make the colon the end-of-string so we know where to stop
|
||||||
looking for targets. */
|
looking for targets. */
|
||||||
*colonp = '\0';
|
*colonp = '\0';
|
||||||
|
14
rule.c
14
rule.c
@ -1,5 +1,5 @@
|
|||||||
/* Pattern and suffix rule internals for GNU Make.
|
/* Pattern and suffix rule internals for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1988,89,90,91,92,93, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@ -14,7 +14,8 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with GNU Make; see the file COPYING. If not, write to
|
along with GNU Make; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "make.h"
|
#include "make.h"
|
||||||
#include "dep.h"
|
#include "dep.h"
|
||||||
@ -664,8 +665,13 @@ print_rule_data_base ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (num_pattern_rules != rules)
|
if (num_pattern_rules != rules)
|
||||||
fatal (NILF, "BUG: num_pattern_rules wrong! %u != %u",
|
{
|
||||||
num_pattern_rules, rules);
|
/* This can happen if a fatal error was detected while reading the
|
||||||
|
makefiles and thus count_implicit_rule_limits wasn't called yet. */
|
||||||
|
if (num_pattern_rules != 0)
|
||||||
|
fatal ("BUG: num_pattern_rules wrong! %u != %u",
|
||||||
|
num_pattern_rules, rules);
|
||||||
|
}
|
||||||
|
|
||||||
puts ("\n# Pattern-specific variable values");
|
puts ("\n# Pattern-specific variable values");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user