summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Magill <magill@gate.net>2000-02-12 22:32:30 +0000
committerTim Magill <magill@gate.net>2000-02-12 22:32:30 +0000
commitb0e3148933fd6e04b3ac447c79edace8b624a3e0 (patch)
tree953060eedf2d83d3da06202bc1251f8b86cc75bb
parent3b4369f1704ca17b3824a61e9f152aff739b334f (diff)
minor cleanup
-rw-r--r--ChangeLog20
-rw-r--r--file.c3
-rw-r--r--filedef.h5
-rw-r--r--implicit.c12
-rw-r--r--remake.c30
5 files changed, 46 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 24e4d16b..5e789e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2000-02-12 Tim Magill <magill@gate.net>
+
+ * implicit.c (try_implicit_rule):
+ * remake.c (check_dep):
+ * remake.c (update_file_1):
+ move setting of tried_implicit into try_implicit_rule(). It is
+ only called in two places and the flag is set immediately after.
+
+
+ * remake.c (update_file_1): collapsed if statement based on
+ file->command_state into switch statment which immediately
+ follows. Removed code that could not be reached.
+
+ * remake.c (update_file): advance f pointer so as not to consider
+ same file twice after breaking loop.
+
+ * file.c (rehash_file): replaced hard coded check_renamed loop
+ with standard macro. seemed like the right thing to do.
+
+
2000-02-09 Tim Magill <magill@gate.net>
Started branch for cleaning up internal make structure regarding
recursion paths. Branch name is filedef-cleanup and was started
diff --git a/file.c b/file.c
index 28de9422..45ff8a58 100644
--- a/file.c
+++ b/file.c
@@ -199,8 +199,7 @@ rehash_file (file, name)
register unsigned int oldhash;
register char *n;
- while (file->renamed != 0)
- file = file->renamed;
+ check_renamed(file);
/* Find the hash values of the old and new names. */
diff --git a/filedef.h b/filedef.h
index dd4988db..cc83b0dc 100644
--- a/filedef.h
+++ b/filedef.h
@@ -61,7 +61,10 @@ struct file
struct file *double_colon;
short int update_status; /* Status of the last attempt to update,
- or -1 if none has been made. */
+ or -1 if none has been made.
+ 0 = commands ran and won
+ 1 = files need to be updated (-q)
+ 2 = commands ran and lost */
enum /* State of the commands. */
{ /* Note: It is important that cs_not_started be zero. */
diff --git a/implicit.c b/implicit.c
index c0ca4ed7..ea45e971 100644
--- a/implicit.c
+++ b/implicit.c
@@ -37,6 +37,7 @@ try_implicit_rule (file, depth)
struct file *file;
unsigned int depth;
{
+ int ret = 0;
DBF (DB_IMPLICIT, _("Looking for an implicit rule for `%s'.\n"));
/* The order of these searches was previously reversed. My logic now is
@@ -45,21 +46,24 @@ try_implicit_rule (file, depth)
should come first. */
if (pattern_search (file, 0, depth, 0))
- return 1;
+ ret = 1;
#ifndef NO_ARCHIVES
/* If this is an archive member reference, use just the
archive member name to search for implicit rules. */
- if (ar_name (file->name))
+ else if (ar_name (file->name))
{
DBF (DB_IMPLICIT,
_("Looking for archive-member implicit rule for `%s'.\n"));
if (pattern_search (file, 1, depth, 0))
- return 1;
+ {
+ ret = 1;
+ }
}
#endif
- return 0;
+ file->tried_implicit = 1;
+ return ret;
}
diff --git a/remake.c b/remake.c
index 1abea0d2..1f0cf270 100644
--- a/remake.c
+++ b/remake.c
@@ -314,7 +314,7 @@ update_file (file, depth)
/* Process the remaining rules in the double colon chain so they're marked
considered. Start their prerequisites, too. */
- for (; f != 0 ; f = f->prev)
+ for (f = (f ? f->prev : 0); f != 0 ; f = f->prev)
{
struct dep *d;
@@ -342,30 +342,28 @@ update_file_1 (file, depth)
DBF (DB_VERBOSE, _("Considering target file `%s'.\n"));
- if (file->command_state == cs_finished)
- {
- if (file->update_status > 0)
- {
- DBF (DB_VERBOSE,
- _("Recently tried and failed to update file `%s'.\n"));
- return file->update_status;
- }
-
- DBF (DB_VERBOSE, _("File `%s' was considered already.\n"));
- return 0;
- }
switch (file->command_state)
{
case cs_not_started:
case cs_deps_running:
break;
+
case cs_running:
DBF (DB_VERBOSE, _("Still updating file `%s'.\n"));
return 0;
+
case cs_finished:
- DBF (DB_VERBOSE, _("Finished updating file `%s'.\n"));
- return file->update_status;
+ if (file->update_status > 0)
+ {
+ DBF (DB_VERBOSE,
+ _("Recently tried and failed to update file `%s'.\n"));
+ return file->update_status;
+ }
+
+ DBF (DB_VERBOSE, _("File `%s' was considered already.\n"));
+ return 0;
+
default:
abort ();
}
@@ -398,7 +396,6 @@ update_file_1 (file, depth)
DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n"));
else
DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n"));
- file->tried_implicit = 1;
}
if (file->cmds == 0 && !file->is_target
&& default_file != 0 && default_file->cmds != 0)
@@ -815,7 +812,6 @@ check_dep (file, depth, this_mtime, must_make_ptr)
DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n"));
else
DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n"));
- file->tried_implicit = 1;
}
if (file->cmds == 0 && !file->is_target
&& default_file != 0 && default_file->cmds != 0)