From 93eb87007a2c4f71357a8132dabe4b03647ca227 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Tue, 31 Jan 2023 00:34:59 +0000 Subject: [PATCH] Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified In some cases, the nullability of the pointer argument is too complicated. Developers have better check relevant manuals or code before annotating. Bugs: b/245972273 Test: None Change-Id: I3589a5080b267d1766cc8ed99868129ac16e4012 --- libc/include/fcntl.h | 2 +- libc/include/regex.h | 4 ++-- libc/include/sys/cdefs.h | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h index 4ef894b87..1ec932bd9 100644 --- a/libc/include/fcntl.h +++ b/libc/include/fcntl.h @@ -149,7 +149,7 @@ int open64(const char* _Nonnull __path, int __flags, ...) __INTRODUCED_IN(21); * * Available since API level 21. */ -ssize_t splice(int __in_fd, off64_t* _Null_unspecified __in_offset, int __out_fd, off64_t* _Null_unspecified __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21); +ssize_t splice(int __in_fd, off64_t* __BIONIC_COMPLICATED_NULLNESS __in_offset, int __out_fd, off64_t* __BIONIC_COMPLICATED_NULLNESS __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21); /** * [tee(2)](http://man7.org/linux/man-pages/man2/tee.2.html) diff --git a/libc/include/regex.h b/libc/include/regex.h index be1418efe..be33819cd 100644 --- a/libc/include/regex.h +++ b/libc/include/regex.h @@ -49,8 +49,8 @@ typedef ssize_t regoff_t; typedef struct { int re_magic; size_t re_nsub; /* number of parenthesized subexpressions */ - const char * _Null_unspecified re_endp; /* end pointer for REG_PEND */ - struct re_guts * _Null_unspecified re_g; /* none of your business :-) */ + const char * __BIONIC_COMPLICATED_NULLNESS re_endp; /* end pointer for REG_PEND */ + struct re_guts * __BIONIC_COMPLICATED_NULLNESS re_g; /* none of your business :-) */ } regex_t; typedef struct { diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index 5b9d99b3a..484757e26 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -62,6 +62,14 @@ #define __BIONIC_ALIGN(__value, __alignment) (((__value) + (__alignment)-1) & ~((__alignment)-1)) +/* + * The nullness constraints of this parameter or return value are + * quite complex. This is used to highlight spots where developers + * are encouraged to read relevant manuals or code to understand + * the full picture of nullness for this pointer. + */ +#define __BIONIC_COMPLICATED_NULLNESS _Null_unspecified + /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.