Module Name: src Committed By: rillig Date: Fri Aug 28 19:46:04 UTC 2020
Modified Files: src/usr.bin/make: enum.c lst.c Log Message: make(1): fix build errors for USER_CPPFLAGS=-DNDEBUG The functions LstIsValid and LstNodeIsValid are only used in assertions. Without the always-false assertion, Enum_ValueToString could have returned undefined behavior. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/enum.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/make/lst.c 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/enum.c diff -u src/usr.bin/make/enum.c:1.4 src/usr.bin/make/enum.c:1.5 --- src/usr.bin/make/enum.c:1.4 Mon Aug 24 20:15:51 2020 +++ src/usr.bin/make/enum.c Fri Aug 28 19:46:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: enum.c,v 1.4 2020/08/24 20:15:51 rillig Exp $ */ +/* $NetBSD: enum.c,v 1.5 2020/08/28 19:46:04 rillig Exp $ */ /* Copyright (c) 2020 Roland Illig <ril...@netbsd.org> @@ -28,15 +28,16 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: enum.c,v 1.4 2020/08/24 20:15:51 rillig Exp $"; +static char rcsid[] = "$NetBSD: enum.c,v 1.5 2020/08/28 19:46:04 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: enum.c,v 1.4 2020/08/24 20:15:51 rillig Exp $"); +__RCSID("$NetBSD: enum.c,v 1.5 2020/08/28 19:46:04 rillig Exp $"); #endif #endif #include <assert.h> +#include <stdlib.h> #include <string.h> #include "enum.h" @@ -90,5 +91,5 @@ Enum_ValueToString(int value, const Enum if (value == spec->es_value) return spec->es_name; } - assert(!"unknown enum value"); + abort(/* unknown enum value */); } Index: src/usr.bin/make/lst.c diff -u src/usr.bin/make/lst.c:1.50 src/usr.bin/make/lst.c:1.51 --- src/usr.bin/make/lst.c:1.50 Fri Aug 28 04:48:57 2020 +++ src/usr.bin/make/lst.c Fri Aug 28 19:46:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 rillig Exp $ */ +/* $NetBSD: lst.c,v 1.51 2020/08/28 19:46:04 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -37,11 +37,11 @@ #include "make.h" #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 rillig Exp $"; +static char rcsid[] = "$NetBSD: lst.c,v 1.51 2020/08/28 19:46:04 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: lst.c,v 1.50 2020/08/28 04:48:57 rillig Exp $"); +__RCSID("$NetBSD: lst.c,v 1.51 2020/08/28 19:46:04 rillig Exp $"); #endif /* not lint */ #endif @@ -75,13 +75,13 @@ struct List { LstNode prev; /* Previous node, if open. Used by Lst_Remove */ }; -static Boolean +static Boolean MAKE_ATTR_UNUSED LstIsValid(Lst list) { return list != NULL; } -static Boolean +static Boolean MAKE_ATTR_UNUSED LstNodeIsValid(LstNode node) { return node != NULL;