]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* remake.c: filedef-cleanup
authorTim Magill <magill@gate.net>
Tue, 14 Mar 2000 04:30:07 +0000 (04:30 +0000)
committerTim Magill <magill@gate.net>
Tue, 14 Mar 2000 04:30:07 +0000 (04:30 +0000)
(update_file_1):
(check_dep): fixed problem with double colon rules and circular
precursor detection.

* remake.c (update_file_1): simplified handling of files with no
command into a single block.

* remake.c (notice_finished_file): fixed obsolete comment.

ChangeLog
remake.c

index d7dc668fe4aa6dddda9d4e7d2bba75d7de9aa62e..c4022c707a6c274aa740d119ed1b467fefcef965 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,21 @@
+2000-03-13  Tim Magill  <magill@gate.net>
+
+       * remake.c: 
+       (update_file_1): 
+       (check_dep): fixed problem with double colon rules and circular
+       precursor detection.
+
 2000-03-12  Tim Magill  <magill@gate.net>
 
        * remake.c (update_goal_chain): re-arranged logic so that it makes
        more sense.  After update_file(), the target status is used to
        handle the goal and possibly remove it from the goal chain.
        
+       * remake.c (update_file_1): simplified handling of files with no
+       command into a single block.
+
+       * remake.c (notice_finished_file): fixed obsolete comment.
+
        * remake.c (update_file): If -q we can bail as soon as we detect
        that something needs to be remade.
 
index e0b1bc0ba843725d84d94f7b43c6ccf70f1d472d..578cd0dfc116f4155f952435d35fccf218fd70a5 100644 (file)
--- a/remake.c
+++ b/remake.c
@@ -56,6 +56,20 @@ typedef enum {
 
   
 
+/* the test for circular dependencies is based just on the 'updating'
+   bit in 'struct file'.  However double colon targets have seperate
+   'struct file's.  Therefore, we will lose if we don't notice that a
+   double colon targets are really the same file.  Use the 'struct
+   file' at the base of the double colon chain. */
+
+#define set_updating(file) (((file)->double_colon ? \
+       (file)->double_colon : (file))->updating = 1)
+#define clr_updating(file) (((file)->double_colon ? \
+       (file)->double_colon : (file))->updating = 0)
+#define tst_updating(file) (((file)->double_colon ? \
+       (file)->double_colon : (file))->updating)
+
+
 /* Incremented when a command is started (under -n, when one would be).  */
 unsigned int commands_started = 0;
 
@@ -373,7 +387,7 @@ update_file_1 (file, depth)
   ++depth;
 
   /* Notice recursive update of the same file.  */
-  file->updating = 1;
+  set_updating(file);
 
   /* Looking at the file's modtime beforehand allows the possibility
      that its name may be changed by a VPATH search, and thus it may
@@ -383,27 +397,30 @@ update_file_1 (file, depth)
 
   this_mtime = file_mtime (file);
   check_renamed (file);
-  noexist = this_mtime == (FILE_TIMESTAMP) -1;
+  must_make = noexist = this_mtime == (FILE_TIMESTAMP) -1;
   if (noexist)
     DBF (DB_BASIC, _("File `%s' does not exist.\n"));
 
-  must_make = noexist;
+
 
   /* If file was specified as a target with no commands,
      come up with some default commands.  */
 
-  if (!file->phony && file->cmds == 0 && !file->tried_implicit)
+  if (file->cmds == 0) 
     {
-      if (try_implicit_rule (file, depth))
-       DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n"));
-      else
-       DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n"));
-    }
-  if (file->cmds == 0 && !file->is_target
-      && default_file != 0 && default_file->cmds != 0)
-    {
-      DBF (DB_IMPLICIT, _("Using default commands for `%s'.\n"));
-      file->cmds = default_file->cmds;
+      if (!file->phony && !file->tried_implicit)
+       {
+         if (try_implicit_rule (file, depth))
+           DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n"));
+         else
+           DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n"));
+       }
+      if (!file->is_target
+         && default_file != 0 && default_file->cmds != 0)
+       {
+         DBF (DB_IMPLICIT, _("Using default commands for `%s'.\n"));
+         file->cmds = default_file->cmds;
+       }
     }
 
   /* Update all non-intermediate files we depend on, if necessary,
@@ -420,7 +437,7 @@ update_file_1 (file, depth)
       mtime = file_mtime (d->file);
       check_renamed (d->file);
 
-      if (d->file->updating)
+      if (tst_updating(d->file))
        {
          error (NILF, _("Circular %s <- %s dependency dropped."),
                 file->name, d->file->name);
@@ -498,7 +515,7 @@ update_file_1 (file, depth)
          }
     }
 
-  file->updating = 0;
+  clr_updating(file);
 
   DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
 
@@ -666,9 +683,8 @@ update_file_1 (file, depth)
     }
 }
 \f
-/* Set FILE's `updated' flag and re-check its mtime and the mtime's of all
-   files listed in its `also_make' member.  Under -t, this function also
-   touches FILE.
+/* re-check FILE's mtime and the mtime's of all files listed in its
+   `also_make' member.  Under -t, this function also touches FILE.
 
    On return, FILE->update_status will no longer be -1 if it was.  */
 
@@ -783,7 +799,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
   target_state_t dep_status = ts_done;
 
   ++depth;
-  file->updating = 1;
+  set_updating(file);
 
   if (!file->intermediate)
     /* If this is a non-intermediate file, update it and record
@@ -834,7 +850,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
          d = file->deps;
          while (d != 0)
            {
-             if (d->file->updating)
+             if (tst_updating(d->file))
                {
                  error (NILF, _("Circular %s <- %s dependency dropped."),
                         file->name, d->file->name);
@@ -873,7 +889,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
        }
     }
 
-  file->updating = 0;
+  clr_updating(file);
   return dep_status;
 }
 \f