From 13742523978fc8259a7d9a6e594c64cbfcfa9e8b Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Mon, 29 Jun 2015 00:30:30 +0000 Subject: [PATCH] Add a new __sentinel attribute. The sentinel attribute was originally implemented in OpenBSD's gcc and later adopted by upstream GCC 4.0 (and clang). From the OpenBSD's gcc-local manpage: - gcc recognizes the extra attribute __sentinel__, which can be used to mark varargs function that need a NULL pointer to mark argument termination, like execl(3). This exposes latent bugs for 64-bit architectures, where a terminating 0 will expand to a 32-bit int, and not a full-fledged 64-bits pointer. While here sort the visibility attributes. Hinted-by: OpenBSD --- sys/sys/cdefs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 23e567cb8bd..1a511cfc0ad 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -469,11 +469,13 @@ #endif #if __GNUC_PREREQ__(4, 0) -#define __hidden __attribute__((__visibility__("hidden"))) +#define __sentinel __attribute__((__sentinel__)) #define __exported __attribute__((__visibility__("default"))) +#define __hidden __attribute__((__visibility__("hidden"))) #else -#define __hidden +#define __sentinel #define __exported +#define __hidden #endif /* -- 2.45.2