Module Name: src Committed By: rillig Date: Mon Oct 10 21:17:26 UTC 2022
Modified Files: src/usr.bin/make: compat.c job.c main.c make.h Log Message: make: change return type of unlink_file back to int As unlink_file is a wrapper around unlink, use the same encoding for the possible return values as in the wrapped function. This consistency is more important than expressing all possible return values in the return type 'bool'. https://mail-index.netbsd.org/tech-toolchain/2022/10/06/msg004155.html No functional change. To generate a diff of this commit: cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/compat.c cvs rdiff -u -r1.455 -r1.456 src/usr.bin/make/job.c cvs rdiff -u -r1.584 -r1.585 src/usr.bin/make/main.c cvs rdiff -u -r1.307 -r1.308 src/usr.bin/make/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.241 src/usr.bin/make/compat.c:1.242 --- src/usr.bin/make/compat.c:1.241 Wed Aug 17 20:10:29 2022 +++ src/usr.bin/make/compat.c Mon Oct 10 21:17:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.241 2022/08/17 20:10:29 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.242 2022/10/10 21:17:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.241 2022/08/17 20:10:29 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.242 2022/10/10 21:17:25 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -107,7 +107,7 @@ CompatDeleteTarget(GNode *gn) if (gn != NULL && !GNode_IsPrecious(gn)) { const char *file = GNode_VarTarget(gn); - if (!opts.noExecute && unlink_file(file)) { + if (!opts.noExecute && unlink_file(file) == 0) { Error("*** %s removed", file); } } Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.455 src/usr.bin/make/job.c:1.456 --- src/usr.bin/make/job.c:1.455 Sat Sep 3 08:41:07 2022 +++ src/usr.bin/make/job.c Mon Oct 10 21:17:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.455 2022/09/03 08:41:07 rillig Exp $ */ +/* $NetBSD: job.c,v 1.456 2022/10/10 21:17:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -142,7 +142,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.455 2022/09/03 08:41:07 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.456 2022/10/10 21:17:25 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -512,7 +512,7 @@ JobDeleteTarget(GNode *gn) return; file = GNode_Path(gn); - if (unlink_file(file)) + if (unlink_file(file) == 0) Error("*** %s removed", file); } Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.584 src/usr.bin/make/main.c:1.585 --- src/usr.bin/make/main.c:1.584 Mon Oct 10 17:33:35 2022 +++ src/usr.bin/make/main.c Mon Oct 10 21:17:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.584 2022/10/10 17:33:35 rillig Exp $ */ +/* $NetBSD: main.c,v 1.585 2022/10/10 21:17:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.584 2022/10/10 17:33:35 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.585 2022/10/10 21:17:25 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1881,13 +1881,13 @@ Finish(int errs) Fatal("%d error%s", errs, errs == 1 ? "" : "s"); } -bool +int unlink_file(const char *file) { struct stat st; if (lstat(file, &st) == -1) - return false; + return -1; if (S_ISDIR(st.st_mode)) { /* @@ -1895,9 +1895,9 @@ unlink_file(const char *file) * a directory unless [...]". */ errno = EISDIR; - return false; + return -1; } - return unlink(file) == 0; + return unlink(file); } static void Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.307 src/usr.bin/make/make.h:1.308 --- src/usr.bin/make/make.h:1.307 Sat Sep 24 16:13:48 2022 +++ src/usr.bin/make/make.h Mon Oct 10 21:17:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.307 2022/09/24 16:13:48 rillig Exp $ */ +/* $NetBSD: make.h,v 1.308 2022/10/10 21:17:25 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -842,7 +842,7 @@ void Fatal(const char *, ...) MAKE_ATTR_ void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void DieHorribly(void) MAKE_ATTR_DEAD; void Finish(int) MAKE_ATTR_DEAD; -bool unlink_file(const char *) MAKE_ATTR_USE; +int unlink_file(const char *) MAKE_ATTR_USE; void execDie(const char *, const char *); char *getTmpdir(void) MAKE_ATTR_USE; bool ParseBoolean(const char *, bool) MAKE_ATTR_USE;