minor cleanup

This commit is contained in:
Tim Magill 2000-02-12 22:32:30 +00:00
parent 3b4369f170
commit b0e3148933
5 changed files with 46 additions and 24 deletions

View file

@ -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

3
file.c
View file

@ -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. */

View file

@ -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. */

View file

@ -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;
}

View file

@ -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)