Merge "Nullability check for wctype module."
diff --git a/libc/include/arpa/nameser.h b/libc/include/arpa/nameser.h
index c01fde6..0e2b67e 100644
--- a/libc/include/arpa/nameser.h
+++ b/libc/include/arpa/nameser.h
@@ -595,29 +595,29 @@
/* The names of these symbols were accidentally prefixed with __ in L. */
/* The duplication here is intentional to avoid declaring different symbols with the same
* declaration. */
-int ns_msg_getflag(ns_msg __handle, int __flag) __INTRODUCED_IN_64(22);
-uint16_t ns_get16(const u_char* _Nonnull __src) __INTRODUCED_IN_64(22);
-uint32_t ns_get32(const u_char* _Nonnull __src) __INTRODUCED_IN_64(22);
-void ns_put16(uint16_t __src, u_char* _Nonnull __dst) __INTRODUCED_IN_64(22);
-void ns_put32(uint32_t __src, u_char* _Nonnull __dst) __INTRODUCED_IN_64(22);
-int ns_initparse(const u_char* _Nonnull __msg, int __msg_size, ns_msg* _Nonnull __handle) __INTRODUCED_IN_64(22);
-int ns_skiprr(const u_char* _Nonnull __ptr, const u_char* _Nonnull __eom, ns_sect __section, int __count) __INTRODUCED_IN_64(22);
-int ns_parserr(ns_msg* _Nonnull __handle, ns_sect __section, int __rr_number, ns_rr* _Nonnull __rr) __INTRODUCED_IN_64(22);
-int ns_sprintrr(const ns_msg* _Nonnull __handle, const ns_rr* _Nonnull __rr, const char* _Nullable __name_ctx, const char* _Nullable __origin, char* _Nonnull __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_sprintrrf(const u_char* _Nonnull __msg, size_t __msg_size, const char* _Nonnull __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* _Nonnull __rdata, size_t __rdata_size, const char* _Nullable __name_ctx, const char* _Nullable __origin, char* _Nonnull __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_format_ttl(u_long __ttl, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntol(const u_char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntop(const u_char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pton(const char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_unpack(const u_char* _Nonnull __msg, const u_char* _Nonnull __eom, const u_char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pack(const u_char* _Nonnull __src, u_char* _Nonnull __dst, int __dst_size, const u_char* _Nullable * _Nullable __dn_ptrs, const u_char* _Nullable * _Nullable __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_uncompress(const u_char* _Nonnull __msg, const u_char* _Nonnull __eom, const u_char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_compress(const char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size, const u_char* _Nullable * _Nullable __dn_ptrs, const u_char* _Nullable * _Nullable __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_skip(const u_char* _Nullable * _Nonnull __ptr_ptr, const u_char* _Nonnull __eom) __INTRODUCED_IN_64(22);
-void ns_name_rollback(const u_char* _Nonnull __src, const u_char* _Nullable * _Nonnull __dn_ptrs, const u_char* _Nullable * _Nonnull __last_dn_ptr) __INTRODUCED_IN_64(22);
+int ns_msg_getflag(ns_msg __handle, int __flag) __INTRODUCED_IN(22);
+uint16_t ns_get16(const u_char* _Nonnull __src) __INTRODUCED_IN(22);
+uint32_t ns_get32(const u_char* _Nonnull __src) __INTRODUCED_IN(22);
+void ns_put16(uint16_t __src, u_char* _Nonnull __dst) __INTRODUCED_IN(22);
+void ns_put32(uint32_t __src, u_char* _Nonnull __dst) __INTRODUCED_IN(22);
+int ns_initparse(const u_char* _Nonnull __msg, int __msg_size, ns_msg* _Nonnull __handle) __INTRODUCED_IN(22);
+int ns_skiprr(const u_char* _Nonnull __ptr, const u_char* _Nonnull __eom, ns_sect __section, int __count) __INTRODUCED_IN(22);
+int ns_parserr(ns_msg* _Nonnull __handle, ns_sect __section, int __rr_number, ns_rr* _Nonnull __rr) __INTRODUCED_IN(22);
+int ns_sprintrr(const ns_msg* _Nonnull __handle, const ns_rr* _Nonnull __rr, const char* _Nullable __name_ctx, const char* _Nullable __origin, char* _Nonnull __buf, size_t __buf_size) __INTRODUCED_IN(22);
+int ns_sprintrrf(const u_char* _Nonnull __msg, size_t __msg_size, const char* _Nonnull __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* _Nonnull __rdata, size_t __rdata_size, const char* _Nullable __name_ctx, const char* _Nullable __origin, char* _Nonnull __buf, size_t __buf_size) __INTRODUCED_IN(22);
+int ns_format_ttl(u_long __ttl, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_ntol(const u_char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_ntop(const u_char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_pton(const char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_unpack(const u_char* _Nonnull __msg, const u_char* _Nonnull __eom, const u_char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_pack(const u_char* _Nonnull __src, u_char* _Nonnull __dst, int __dst_size, const u_char* _Nullable * _Nullable __dn_ptrs, const u_char* _Nullable * _Nullable __last_dn_ptr) __INTRODUCED_IN(22);
+int ns_name_uncompress(const u_char* _Nonnull __msg, const u_char* _Nonnull __eom, const u_char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_name_compress(const char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size, const u_char* _Nullable * _Nullable __dn_ptrs, const u_char* _Nullable * _Nullable __last_dn_ptr) __INTRODUCED_IN(22);
+int ns_name_skip(const u_char* _Nullable * _Nonnull __ptr_ptr, const u_char* _Nonnull __eom) __INTRODUCED_IN(22);
+void ns_name_rollback(const u_char* _Nonnull __src, const u_char* _Nullable * _Nonnull __dn_ptrs, const u_char* _Nullable * _Nonnull __last_dn_ptr) __INTRODUCED_IN(22);
-int ns_makecanon(const char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_samename(const char* _Nonnull __lhs, const char* _Nonnull __rhs) __INTRODUCED_IN_64(22);
+int ns_makecanon(const char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size) __INTRODUCED_IN(22);
+int ns_samename(const char* _Nonnull __lhs, const char* _Nonnull __rhs) __INTRODUCED_IN(22);
#endif /* !defined(__LP64__) */
__END_DECLS
diff --git a/libc/include/iconv.h b/libc/include/iconv.h
index 794a292..27e04bb 100644
--- a/libc/include/iconv.h
+++ b/libc/include/iconv.h
@@ -50,6 +50,12 @@
* [iconv_open(3)](http://man7.org/linux/man-pages/man3/iconv_open.3.html) allocates a new converter
* from `__src_encoding` to `__dst_encoding`.
*
+ * Android supports the `utf8`, `ascii`, `usascii`, `utf16be`, `utf16le`, `utf32be`, `utf32le`,
+ * and `wchart` encodings for both source and destination.
+ *
+ * Android supports the GNU `//IGNORE` and `//TRANSLIT` extensions for the
+ * destination encoding.
+ *
* Returns a new `iconv_t` on success and returns `((iconv_t) -1)` and sets `errno` on failure.
*
* Available since API level 28.
@@ -60,9 +66,6 @@
* [iconv(3)](http://man7.org/linux/man-pages/man3/iconv.3.html) converts characters from one
* encoding to another.
*
- * Android supports the `utf8`, `ascii`, `usascii`, `utf16be`, `utf16le`, `utf32be`, `utf32le`,
- * and `wchart` encodings. Android also supports the GNU `//IGNORE` and `//TRANSLIT` extensions.
- *
* Returns the number of characters converted on success and returns `((size_t) -1)` and
* sets `errno` on failure.
*
diff --git a/libc/platform/bionic/android_unsafe_frame_pointer_chase.h b/libc/platform/bionic/android_unsafe_frame_pointer_chase.h
index 2b9a32f..406ad92 100644
--- a/libc/platform/bionic/android_unsafe_frame_pointer_chase.h
+++ b/libc/platform/bionic/android_unsafe_frame_pointer_chase.h
@@ -44,4 +44,4 @@
* take stack traces efficiently. Normal applications should use APIs such as libunwindstack or
* _Unwind_Backtrace.
*/
-extern "C" size_t android_unsafe_frame_pointer_chase(uintptr_t* buf, size_t num_entries);
+extern "C" size_t android_unsafe_frame_pointer_chase(uintptr_t* _Nonnull buf, size_t num_entries);
diff --git a/libc/platform/bionic/fdtrack.h b/libc/platform/bionic/fdtrack.h
index fe6ca84..7fc304a 100644
--- a/libc/platform/bionic/fdtrack.h
+++ b/libc/platform/bionic/fdtrack.h
@@ -43,6 +43,8 @@
ANDROID_FDTRACK_EVENT_TYPE_CLOSE,
};
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
struct android_fdtrack_event {
// File descriptor for which this event occurred.
int fd;
@@ -57,12 +59,15 @@
} create;
} data;
};
+#pragma clang diagnostic pop
// Callback invoked upon file descriptor creation/closure.
-typedef void (*android_fdtrack_hook_t)(struct android_fdtrack_event*);
+typedef void (*_Nullable android_fdtrack_hook_t)(struct android_fdtrack_event* _Nullable);
// Register a hook which is called to track fd lifecycle events.
-bool android_fdtrack_compare_exchange_hook(android_fdtrack_hook_t* expected, android_fdtrack_hook_t value) __INTRODUCED_IN(30);
+// Set value to null to disable tracking.
+bool android_fdtrack_compare_exchange_hook(android_fdtrack_hook_t* _Nonnull expected,
+ android_fdtrack_hook_t value) __INTRODUCED_IN(30);
// Enable/disable fdtrack *on the current thread*.
// This is primarily useful when performing operations which you don't want to track
diff --git a/libc/platform/bionic/macros.h b/libc/platform/bionic/macros.h
index 9e13e0d..93268c1 100644
--- a/libc/platform/bionic/macros.h
+++ b/libc/platform/bionic/macros.h
@@ -40,12 +40,12 @@
}
template <typename T>
-static inline T* align_down(T* p, size_t align) {
+static inline T* _Nonnull align_down(T* _Nonnull p, size_t align) {
return reinterpret_cast<T*>(align_down(reinterpret_cast<uintptr_t>(p), align));
}
template <typename T>
-static inline T* align_up(T* p, size_t align) {
+static inline T* _Nonnull align_up(T* _Nonnull p, size_t align) {
return reinterpret_cast<T*>(align_up(reinterpret_cast<uintptr_t>(p), align));
}
@@ -94,6 +94,6 @@
}
template <typename T>
-static inline T* untag_address(T* p) {
+static inline T* _Nonnull untag_address(T* _Nonnull p) {
return reinterpret_cast<T*>(untag_address(reinterpret_cast<uintptr_t>(p)));
}
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index 3c290fc..0a6546e 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -33,7 +33,8 @@
#include <stdint.h>
// Structures for android_mallopt.
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
typedef struct {
// Pointer to the buffer allocated by a call to M_GET_MALLOC_LEAK_INFO.
uint8_t* buffer;
@@ -47,7 +48,7 @@
// The maximum number of backtrace entries.
size_t backtrace_size;
} android_mallopt_leak_info_t;
-
+#pragma clang diagnostic pop
// Opcodes for android_mallopt.
enum {
@@ -105,6 +106,8 @@
#define M_MEMTAG_STACK_IS_ON M_MEMTAG_STACK_IS_ON
};
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
typedef struct {
// The null-terminated name that the zygote is spawning. Because native
// SpecializeCommon (where the GWP-ASan mallopt() is called from) happens
@@ -147,9 +150,9 @@
Action desire = DONT_TURN_ON_UNLESS_OVERRIDDEN;
} android_mallopt_gwp_asan_options_t;
-
+#pragma clang diagnostic pop
// Manipulates bionic-specific handling of memory allocation APIs such as
// malloc. Only for use by the Android platform and APEXes.
//
// On success, returns true. On failure, returns false and sets errno.
-extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size);
+extern "C" bool android_mallopt(int opcode, void* _Nullable arg, size_t arg_size);
diff --git a/libc/platform/scudo_platform_tls_slot.h b/libc/platform/scudo_platform_tls_slot.h
index 9d017c0..a86b828 100644
--- a/libc/platform/scudo_platform_tls_slot.h
+++ b/libc/platform/scudo_platform_tls_slot.h
@@ -30,6 +30,6 @@
#include "bionic/tls.h"
-inline uintptr_t *getPlatformAllocatorTlsSlot() {
+inline uintptr_t* _Nonnull getPlatformAllocatorTlsSlot() {
return reinterpret_cast<uintptr_t*>(&__get_tls()[TLS_SLOT_SANITIZER]);
}