summaryrefslogtreecommitdiff
path: root/usr.bin/make/make.h
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2021-12-15 09:29:55 +0000
committerrillig <rillig@NetBSD.org>2021-12-15 09:29:55 +0000
commite379dafa6d63e14f1c79fd4ad7a2a491428ecdfd (patch)
treeda93384b872ad24c3d8057beca9d16845d43ae7e /usr.bin/make/make.h
parent09a4507e449d0fa578a94cd79117298b72268ee3 (diff)
make: prevent memory leaks from buffers
The warning about unused function results would have prevented the memory leak that was fixed in cond.c 1.303 from 2021-12-13.
Diffstat (limited to 'usr.bin/make/make.h')
-rw-r--r--usr.bin/make/make.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 0d101364230..7a5595a113a 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.272 2021/12/13 22:26:21 rillig Exp $ */
+/* $NetBSD: make.h,v 1.273 2021/12/15 09:29:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -130,6 +130,12 @@
#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
#endif
+#if MAKE_GNUC_PREREQ(4, 0)
+#define MAKE_ATTR_USE __attribute__((__warn_unused_result__))
+#else
+#define MAKE_ATTR_USE /* delete */
+#endif
+
#define MAKE_INLINE static inline MAKE_ATTR_UNUSED
/* MAKE_STATIC marks a function that may or may not be inlined. */