* 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> 1999-04-26 Paul D. Smith <psmith@gnu.org>
* main.c (main): Reset read_makefiles to empty after processing so * 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 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 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_DEFUN(AC_FUNC_SELECT,
[AC_CHECK_FUNCS(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_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_size_t,dnl
[AC_CACHE_VAL(ac_cv_type_fd_set,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_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 for ac_type_timeval in 'struct timeval' 'const struct timeval'; do
AC_TRY_COMPILE(dnl AC_TRY_COMPILE(dnl

74
read.c
View File

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

View File

@ -266,7 +266,7 @@ no_rule_error(file)
= "%sNo rule to make target `%s', needed by `%s'%s"; = "%sNo rule to make target `%s', needed by `%s'%s";
if (keep_going_flag || file->dontcare) if (keep_going_flag || file->dontcare)
{ {
if (!file->dontcare) if (!file->dontcare && !file->shownerror)
{ {
if (file->parent == 0) if (file->parent == 0)
error (NILF, msg_noparent, "*** ", file->name, "."); error (NILF, msg_noparent, "*** ", file->name, ".");
@ -355,13 +355,8 @@ update_file_1 (file, depth)
if (file->update_status > 0) if (file->update_status > 0)
{ {
DEBUGPR ("Recently tried and failed to update file `%s'.\n"); DEBUGPR ("Recently tried and failed to update file `%s'.\n");
if (!file->shownerror) if (!file->shownerror && file->parent)
{ no_rule_error(file);
int dontcare = file->dontcare;
file->dontcare = 0;
no_rule_error(file);
file->dontcare = dontcare;
}
return file->update_status; 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))) if (!streq (dep_name (d), dep_name (d2)))
break; break;
if (d == 0 && d2 == 0) if (d == 0 && d2 == 0)
/* All the dependencies matched. */ {
if (override) /* All the dependencies matched. */
{ if (override)
/* Remove the old rule. */ {
freerule (r, lastrule); /* Remove the old rule. */
/* Install the new one. */ freerule (r, lastrule);
if (pattern_rules == 0) /* Install the new one. */
pattern_rules = rule; if (pattern_rules == 0)
else pattern_rules = rule;
last_pattern_rule->next = rule; else
last_pattern_rule = rule; last_pattern_rule->next = rule;
last_pattern_rule = rule;
/* We got one. Stop looking. */ /* We got one. Stop looking. */
goto matched; goto matched;
} }
else else
{ {
/* The old rule stays intact. Destroy the new one. */ /* The old rule stays intact. Destroy the new one. */
freerule (rule, (struct rule *) 0); freerule (rule, (struct rule *) 0);
return 0; return 0;
} }
}
} }
} }