]> git.ipfire.org Git - thirdparty/make.git/commitdiff
minor cleanup
authorTim Magill <magill@gate.net>
Sat, 12 Feb 2000 22:32:30 +0000 (22:32 +0000)
committerTim Magill <magill@gate.net>
Sat, 12 Feb 2000 22:32:30 +0000 (22:32 +0000)
ChangeLog
file.c
filedef.h
implicit.c
remake.c

index 24e4d16b475d82cefe36d78a839d026316e1d06a..5e789e787f840c15010165938eedba17d3cec900 100644 (file)
--- 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 28de9422743bd41a64ad05c234f0dfb3a8f1d08b..45ff8a5806ad0a7e0f33149e82f5e42b0f5311c8 100644 (file)
--- 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.  */
 
index dd4988db0cf74fe92dae3d8eedce3baa41030143..cc83b0dceb48e2453235152d98de7153c8b62af0 100644 (file)
--- 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.  */
index c0ca4ed72c614a373d0d6fa4bf1b88e1520a21a3..ea45e9719e45f02a330d9c94029b4a110ef7f107 100644 (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;
 }
 \f
 
index 1abea0d228129c16644a669221cb4cea6b131f0c..1f0cf270d2457bc59f102174a274948e7f1dc887 100644 (file)
--- 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)