From 2858f7a8f11990a8b9391e70ab4cdaa271522ece Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 14 Jun 1999 06:50:28 +0000 Subject: * Various bug fixes. --- ChangeLog | 18 +++++++++++++++ acinclude.m4 | 3 ++- read.c | 74 ++++++++++++++++++++++++++++++++---------------------------- remake.c | 11 +++------ rule.c | 44 +++++++++++++++++++----------------- 5 files changed, 86 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c495b..bc98eb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +1999-06-14 Paul D. Smith + + * read.c (read_makefile): Cast -1 arguments to + variable_expand_string() to long. Alexandre Sauve + 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 . + + * read.c (get_next_mword): Allow colons to be escaped in target + names: fix for regression failure. + 1999-04-26 Paul D. Smith * main.c (main): Reset read_makefiles to empty after processing so diff --git a/acinclude.m4 b/acinclude.m4 index 01e4f6b..d3ef3a2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -215,6 +215,7 @@ dnl From Steve Robbins 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 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 diff --git a/read.c b/read.c index 1b340ac..3cbd392 100644 --- a/read.c +++ b/read.c @@ -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 '\\': diff --git a/remake.c b/remake.c index 674f7ef..973c447 100644 --- a/remake.c +++ b/remake.c @@ -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; } diff --git a/rule.c b/rule.c index 2099e3c..08ab640 100644 --- a/rule.c +++ b/rule.c @@ -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; - - /* We got one. Stop looking. */ - goto matched; - } - else - { - /* The old rule stays intact. Destroy the new one. */ - freerule (rule, (struct rule *) 0); - return 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; + + /* We got one. Stop looking. */ + goto matched; + } + else + { + /* The old rule stays intact. Destroy the new one. */ + freerule (rule, (struct rule *) 0); + return 0; + } + } } } -- cgit v1.2.3