* Various bug fixes.

This commit is contained in:
Paul Smith 1999-06-14 06:50:28 +00:00
parent 187787286d
commit 2858f7a8f1
5 changed files with 85 additions and 63 deletions

View file

@ -1,3 +1,21 @@
1999-06-14 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): Cast -1 arguments to
variable_expand_string() to long. Alexandre Sauve
<Alexandre.SAUVE@ifp.fr> reports that without casts, this breaks
on a NEC SUPER-UX SX-4 system (and it's wrong without a cast
anyway). Of course, (a) I'd really love to start using function
prototypes, and (b) there's a whole slew of issues related to int
vs. long and signed vs. unsigned in the length handling of
variable buffers, etc. Gross. Needs a complete mucking-out.
* expand.c (variable_expand): Ditto.
* acinclude.m4 (AC_FUNC_SELECT): Slight enhancement for AIX 3.2 by
Lars Hecking <lhecking@nmrc.ucc.ie>.
* read.c (get_next_mword): Allow colons to be escaped in target
names: fix for regression failure.
1999-04-26 Paul D. Smith <psmith@gnu.org>
* main.c (main): Reset read_makefiles to empty after processing so

View file

@ -215,6 +215,7 @@ dnl From Steve Robbins <steve@nyongwa.montreal.qc.ca>
dnl From a proposed change made on the autoconf list on 2 Feb 1999
dnl http://sourceware.cygnus.com/ml/autoconf/1999-02/msg00001.html
dnl Patch for AIX 3.2 by Lars Hecking <lhecking@nmrc.ucc.ie> on 17 May 1999
AC_DEFUN(AC_FUNC_SELECT,
[AC_CHECK_FUNCS(select)
@ -223,7 +224,7 @@ if test "$ac_cv_func_select" = yes; then
AC_MSG_CHECKING([argument types of select()])
AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl
[AC_CACHE_VAL(ac_cv_type_fd_set,dnl
[for ac_cv_type_fd_set in 'fd_set' 'int'; do
[for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do
for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_type_timeval in 'struct timeval' 'const struct timeval'; do
AC_TRY_COMPILE(dnl

74
read.c
View file

@ -806,7 +806,7 @@ read_makefile (filename, flags)
entirely consistent, since we do an unconditional
expand below once we know we don't have a
target-specific variable. */
(void)variable_expand_string(pend, lb_next, -1);
(void)variable_expand_string(pend, lb_next, (long)-1);
lb_next += strlen(lb_next);
p2 = variable_buffer + p2_off;
cmdleft = variable_buffer + cmd_off + 1;
@ -921,7 +921,7 @@ read_makefile (filename, flags)
if (*lb_next != '\0')
{
unsigned int l = p2 - variable_buffer;
(void)variable_expand_string(p2 + plen, lb_next, -1);
(void)variable_expand_string(p2 + plen, lb_next, (long)-1);
p2 = variable_buffer + l;
/* Look for a semicolon in the expanded line. */
@ -1305,10 +1305,12 @@ conditional_line (line, flocp)
if (*line == '(')
++count;
else if (*line == ')')
if (count <= 0)
break;
else
--count;
{
if (count <= 0)
break;
else
--count;
}
}
}
else
@ -1554,35 +1556,38 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
this = nextf != 0 ? copy_dep_chain (deps) : deps;
if (pattern != 0)
/* If this is an extended static rule:
`targets: target%pattern: dep%pattern; cmds',
translate each dependency pattern into a plain filename
using the target pattern and this target's name. */
if (!pattern_matches (pattern, pattern_percent, name))
{
/* Give a warning if the rule is meaningless. */
error (flocp,"target `%s' doesn't match the target pattern", name);
this = 0;
}
else
{
/* We use patsubst_expand to do the work of translating
the target pattern, the target's name and the dependencies'
patterns into plain dependency names. */
char *buffer = variable_expand ("");
{
/* If this is an extended static rule:
`targets: target%pattern: dep%pattern; cmds',
translate each dependency pattern into a plain filename
using the target pattern and this target's name. */
if (!pattern_matches (pattern, pattern_percent, name))
{
/* Give a warning if the rule is meaningless. */
error (flocp,
"target `%s' doesn't match the target pattern", name);
this = 0;
}
else
{
/* We use patsubst_expand to do the work of translating
the target pattern, the target's name and the dependencies'
patterns into plain dependency names. */
char *buffer = variable_expand ("");
for (d = this; d != 0; d = d->next)
{
char *o;
char *percent = find_percent (d->name);
if (percent == 0)
continue;
o = patsubst_expand (buffer, name, pattern, d->name,
pattern_percent, percent);
free (d->name);
d->name = savestring (buffer, o - buffer);
}
}
for (d = this; d != 0; d = d->next)
{
char *o;
char *percent = find_percent (d->name);
if (percent == 0)
continue;
o = patsubst_expand (buffer, name, pattern, d->name,
pattern_percent, percent);
free (d->name);
d->name = savestring (buffer, o - buffer);
}
}
}
if (!two_colon)
{
@ -2344,6 +2349,7 @@ get_next_mword (buffer, delim, startp, length)
case '\\':
switch (*p)
{
case ':':
case ';':
case '=':
case '\\':

View file

@ -266,7 +266,7 @@ no_rule_error(file)
= "%sNo rule to make target `%s', needed by `%s'%s";
if (keep_going_flag || file->dontcare)
{
if (!file->dontcare)
if (!file->dontcare && !file->shownerror)
{
if (file->parent == 0)
error (NILF, msg_noparent, "*** ", file->name, ".");
@ -355,13 +355,8 @@ update_file_1 (file, depth)
if (file->update_status > 0)
{
DEBUGPR ("Recently tried and failed to update file `%s'.\n");
if (!file->shownerror)
{
int dontcare = file->dontcare;
file->dontcare = 0;
no_rule_error(file);
file->dontcare = dontcare;
}
if (!file->shownerror && file->parent)
no_rule_error(file);
return file->update_status;
}

42
rule.c
View file

@ -334,27 +334,29 @@ new_pattern_rule (rule, override)
if (!streq (dep_name (d), dep_name (d2)))
break;
if (d == 0 && d2 == 0)
/* All the dependencies matched. */
if (override)
{
/* Remove the old rule. */
freerule (r, lastrule);
/* Install the new one. */
if (pattern_rules == 0)
pattern_rules = rule;
else
last_pattern_rule->next = rule;
last_pattern_rule = rule;
{
/* All the dependencies matched. */
if (override)
{
/* Remove the old rule. */
freerule (r, lastrule);
/* Install the new one. */
if (pattern_rules == 0)
pattern_rules = rule;
else
last_pattern_rule->next = rule;
last_pattern_rule = rule;
/* We got one. Stop looking. */
goto matched;
}
else
{
/* The old rule stays intact. Destroy the new one. */
freerule (rule, (struct rule *) 0);
return 0;
}
/* We got one. Stop looking. */
goto matched;
}
else
{
/* The old rule stays intact. Destroy the new one. */
freerule (rule, (struct rule *) 0);
return 0;
}
}
}
}