Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): change return type of Arch_MemberMTime...



details:   https://anonhg.NetBSD.org/src/rev/e8d78c6116ef
branches:  trunk
changeset: 945840:e8d78c6116ef
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 09:06:22 2020 +0000

description:
make(1): change return type of Arch_MemberMTime to void

This makes it easier to prove that Dir_MTime always returns gn->mtime,
without looking at the implementation of Arch_UpdateMemberMTime.

diffstat:

 usr.bin/make/arch.c    |  16 +++++++---------
 usr.bin/make/dir.c     |   8 ++++----
 usr.bin/make/make.c    |   7 +++++--
 usr.bin/make/nonints.h |   4 ++--
 4 files changed, 18 insertions(+), 17 deletions(-)

diffs (131 lines):

diff -r 9b23bd40e733 -r e8d78c6116ef usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sun Nov 08 08:55:25 2020 +0000
+++ b/usr.bin/make/arch.c       Sun Nov 08 09:06:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -98,7 +98,7 @@
  *                     placed in the member's GNode. Returns the
  *                     modification time.
  *
- *     Arch_MemberMTime
+ *     Arch_UpdateMemberMTime
  *                     Find the modification time of a member of
  *                     an archive. Called when the member doesn't
  *                     already exist. Looks in the archive for the
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -906,10 +906,10 @@
     return modTime;
 }
 
-/* Given a non-existent archive member's node, get its modification time from
- * its archived form, if it exists. gn->mtime is filled in as well. */
-time_t
-Arch_MemberMTime(GNode *gn)
+/* Given a non-existent archive member's node, update gn->mtime from its
+ * archived form, if it exists. */
+void
+Arch_UpdateMemberMTime(GNode *gn)
 {
     GNodeListNode *ln;
 
@@ -941,8 +941,6 @@
            break;
        }
     }
-
-    return gn->mtime;
 }
 
 /* Search for a library along the given search path.
diff -r 9b23bd40e733 -r e8d78c6116ef usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sun Nov 08 08:55:25 2020 +0000
+++ b/usr.bin/make/dir.c        Sun Nov 08 09:06:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1349,13 +1349,13 @@
     if (fullName == NULL)
        fullName = bmake_strdup(gn->name);
 
-
     flags = recheck ? CST_UPDATE : CST_NONE;
     if (cached_stats(&mtimes, fullName, &mst, flags) < 0) {
        if (gn->type & OP_MEMBER) {
            if (fullName != gn->path)
                free(fullName);
-           return Arch_MemberMTime(gn);
+           Arch_UpdateMemberMTime(gn);
+           return gn->mtime;
        }
 
        mst.mst_mtime = 0;
diff -r 9b23bd40e733 -r e8d78c6116ef usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sun Nov 08 08:55:25 2020 +0000
+++ b/usr.bin/make/make.c       Sun Nov 08 09:06:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.193 2020/11/08 09:06:23 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.193 2020/11/08 09:06:23 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -553,6 +553,9 @@
               gn->name, Targ_FmtTime(gn->mtime));
     }
 #endif
+
+    /* XXX: The returned mtime may differ from gn->mtime.
+     * Intentionally? */
     return mtime;
 }
 
diff -r 9b23bd40e733 -r e8d78c6116ef usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sun Nov 08 08:55:25 2020 +0000
+++ b/usr.bin/make/nonints.h    Sun Nov 08 09:06:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.156 2020/11/07 21:31:07 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.157 2020/11/08 09:06:23 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -80,7 +80,7 @@
 void Arch_Touch(GNode *);
 void Arch_TouchLib(GNode *);
 time_t Arch_MTime(GNode *);
-time_t Arch_MemberMTime(GNode *);
+void Arch_UpdateMemberMTime(GNode *gn);
 void Arch_FindLib(GNode *, SearchPath *);
 Boolean Arch_LibOODate(GNode *);
 Boolean Arch_IsLib(GNode *);



Home | Main Index | Thread Index | Old Index