From d80a52eb656042b98f519025e52b06c3010ae174 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 10 Aug 2016 15:18:29 -0700 Subject: [PATCH] Add __attribute__((sentinel)) tags to execl and friends. Give a compile time diagnostic when the nullptr sentinel is missing from an execl family call, instead of just pulling arbitrary values. Bug: http://b/30793878 Change-Id: I1c49005c58b7ad4a5b04f0435b722d4c744e8f0e Test: Built bullhead --- libc/include/unistd.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libc/include/unistd.h b/libc/include/unistd.h index c7922895c..86949de8e 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -97,9 +97,10 @@ int execv(const char* __path, char* const* __argv); int execvp(const char* __file, char* const* __argv); int execvpe(const char* __file, char* const* __argv, char* const* __envp) __INTRODUCED_IN(21); int execve(const char* __file, char* const* __argv, char* const* __envp); -int execl(const char* __path, const char* __arg0, ...); -int execlp(const char* __file, const char* __arg0, ...); -int execle(const char* __path, const char* __arg0, ...); +int execl(const char* __path, const char* __arg0, ...) __attribute__((__sentinel__)); +int execlp(const char* __file, const char* __arg0, ...) __attribute__((__sentinel__)); +int execle(const char* __path, const char* __arg0, ... /*, char* const* __envp */) + __attribute__((__sentinel__(1))); int nice(int __incr);