Merge "time.h: add doc comments."
diff --git a/libc/include/arpa/inet.h b/libc/include/arpa/inet.h
index db054c9..748b7a1 100644
--- a/libc/include/arpa/inet.h
+++ b/libc/include/arpa/inet.h
@@ -36,17 +36,17 @@
 
 __BEGIN_DECLS
 
-in_addr_t inet_addr(const char* __s);
-int inet_aton(const char* __s, struct in_addr* __addr);
+in_addr_t inet_addr(const char* _Nonnull __s);
+int inet_aton(const char* _Nonnull __s, struct in_addr* _Nullable __addr);
 in_addr_t inet_lnaof(struct in_addr __addr) __INTRODUCED_IN(21);
 struct in_addr inet_makeaddr(in_addr_t __net, in_addr_t __host) __INTRODUCED_IN(21);
 in_addr_t inet_netof(struct in_addr __addr) __INTRODUCED_IN(21);
-in_addr_t inet_network(const char* __s) __INTRODUCED_IN(21);
-char* inet_ntoa(struct in_addr __addr);
-const char* inet_ntop(int __af, const void* __src, char* __dst, socklen_t __size);
-unsigned int inet_nsap_addr(const char* __ascii, unsigned char* __binary, int __n);
-char* inet_nsap_ntoa(int __binary_length, const unsigned char* __binary, char* __ascii);
-int inet_pton(int __af, const char* __src, void* __dst);
+in_addr_t inet_network(const char* _Nonnull __s) __INTRODUCED_IN(21);
+char* _Nonnull inet_ntoa(struct in_addr __addr);
+const char* _Nullable inet_ntop(int __af, const void* _Nonnull __src, char* _Nonnull __dst, socklen_t __size);
+unsigned int inet_nsap_addr(const char* _Nonnull __ascii, unsigned char* _Nonnull __binary, int __n);
+char* _Nonnull inet_nsap_ntoa(int __binary_length, const unsigned char* _Nonnull __binary, char* _Nullable __ascii);
+int inet_pton(int __af, const char* _Nonnull __src, void* _Nonnull __dst);
 
 __END_DECLS
 
diff --git a/libc/include/arpa/nameser.h b/libc/include/arpa/nameser.h
index 89ece1c..c01fde6 100644
--- a/libc/include/arpa/nameser.h
+++ b/libc/include/arpa/nameser.h
@@ -113,6 +113,8 @@
 typedef const u_char *ns_nname_ct;
 typedef u_char *ns_nname_t;
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
 struct ns_namemap { ns_nname_ct base; int len; };
 typedef struct ns_namemap *ns_namemap_t;
 typedef const struct ns_namemap *ns_namemap_ct;
@@ -269,6 +271,8 @@
 };
 typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
 
+#pragma clang diagnostic pop
+
 #define NS_TSIG_FUDGE 300
 #define NS_TSIG_TCP_COUNT 100
 #define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
@@ -564,56 +568,56 @@
 #define	ns_samename		__ns_samename
 
 int ns_msg_getflag(ns_msg __handle, int __flag);
-uint16_t ns_get16(const u_char* __src);
-uint32_t ns_get32(const u_char* __src);
-void ns_put16(uint16_t __src, u_char* __dst);
-void ns_put32(uint32_t __src, u_char* __dst);
-int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle);
-int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count);
-int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr);
-int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size);
-int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size);
-int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size);
-int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size);
-int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size);
-int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size);
-int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size);
-int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
-int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size);
-int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
-int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom);
-void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
+uint16_t ns_get16(const u_char* _Nonnull __src);
+uint32_t ns_get32(const u_char* _Nonnull __src);
+void ns_put16(uint16_t __src, u_char* _Nonnull __dst);
+void ns_put32(uint32_t __src, u_char* _Nonnull __dst);
+int ns_initparse(const u_char* _Nonnull __msg, int __msg_size, ns_msg* _Nonnull __handle);
+int ns_skiprr(const u_char* _Nonnull __ptr, const u_char* _Nonnull __eom, ns_sect __section, int __count);
+int ns_parserr(ns_msg* _Nonnull __handle, ns_sect __section, int __rr_number, ns_rr* _Nonnull __rr);
+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);
+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);
+int ns_format_ttl(u_long __ttl, char* _Nonnull __dst, size_t __dst_size);
+int ns_name_ntol(const u_char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size);
+int ns_name_ntop(const u_char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size);
+int ns_name_pton(const char* _Nonnull __src, u_char* _Nonnull __dst, size_t __dst_size);
+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);
+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);
+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);
+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);
+int ns_name_skip(const u_char* _Nullable * _Nonnull __ptr_ptr, const u_char* _Nonnull __eom);
+void ns_name_rollback(const u_char* _Nonnull __src, const u_char* _Nullable * _Nonnull __dn_ptrs, const u_char* _Nullable * _Nonnull __last_dn_ptr);
 
-int ns_makecanon(const char* __src, char* __dst, size_t __dst_size);
-int ns_samename(const char* __lhs, const char* __rhs);
+int ns_makecanon(const char* _Nonnull __src, char* _Nonnull __dst, size_t __dst_size);
+int ns_samename(const char* _Nonnull __lhs, const char* _Nonnull __rhs);
 
 #else
 /* 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* __src) __INTRODUCED_IN_64(22);
-uint32_t ns_get32(const u_char* __src) __INTRODUCED_IN_64(22);
-void ns_put16(uint16_t __src, u_char* __dst) __INTRODUCED_IN_64(22);
-void ns_put32(uint32_t __src, u_char* __dst) __INTRODUCED_IN_64(22);
-int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle) __INTRODUCED_IN_64(22);
-int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count) __INTRODUCED_IN_64(22);
-int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr) __INTRODUCED_IN_64(22);
-int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(22);
-int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(22);
-int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom) __INTRODUCED_IN_64(22);
-void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __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_makecanon(const char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(22);
-int ns_samename(const char* __lhs, const char* __rhs) __INTRODUCED_IN_64(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);
 #endif /* !defined(__LP64__) */
 
 __END_DECLS
diff --git a/libc/include/assert.h b/libc/include/assert.h
index 8db970b..750d12e 100644
--- a/libc/include/assert.h
+++ b/libc/include/assert.h
@@ -64,7 +64,8 @@
 # endif
 #endif
 
-#if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
+/* `static_assert` is a keyword in C++11 and C23; C11 had `_Static_assert` instead. */
+#if !defined(__cplusplus) && (__STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L)
 # undef static_assert
 # define static_assert _Static_assert
 #endif
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index 7afdc1a..88214d5 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -78,32 +78,34 @@
  * supplied in host order, and returned in network order (suitable for
  * use in system calls).
  */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
 struct hostent {
-	char	* _Nullable h_name;	/* official name of host */
-	char	* _Nullable * _Nullable h_aliases;	/* alias list */
+	char	*h_name;	/* official name of host */
+	char	**h_aliases;	/* alias list */
 	int	h_addrtype;	/* host address type */
 	int	h_length;	/* length of address */
-	char	* _Nullable * _Nullable h_addr_list;	/* list of addresses from name server */
+	char	**h_addr_list;	/* list of addresses from name server */
 #define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
 };
 
 struct netent {
-	char		* _Nullable n_name;	/* official name of net */
-	char		* _Nullable * _Nullable n_aliases;	/* alias list */
+	char		*n_name;	/* official name of net */
+	char		**n_aliases;	/* alias list */
 	int		n_addrtype;	/* net address type */
 	uint32_t	n_net;		/* network # */
 };
 
 struct servent {
-	char	* _Nullable s_name;	/* official service name */
-	char	* _Nullable * _Nullable s_aliases;	/* alias list */
+	char	*s_name;	/* official service name */
+	char	**s_aliases;	/* alias list */
 	int	s_port;		/* port # */
 	char	* _Nullable s_proto;	/* protocol to use */
 };
 
 struct protoent {
-	char	* _Nullable p_name;	/* official protocol name */
-	char	* _Nullable * _Nullable p_aliases;	/* alias list */
+	char	*p_name;	/* official protocol name */
+	char	**p_aliases;	/* alias list */
 	int	p_proto;	/* protocol # */
 };
 
@@ -113,10 +115,11 @@
 	int	ai_socktype;	/* SOCK_xxx */
 	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
 	socklen_t ai_addrlen;	/* length of ai_addr */
-	char	* _Nullable ai_canonname;	/* canonical name for hostname */
-	struct	sockaddr * _Nullable ai_addr;	/* binary address */
-	struct	addrinfo * _Nullable ai_next;	/* next structure in linked list */
+	char	*ai_canonname;	/* canonical name for hostname */
+	struct	sockaddr *ai_addr;	/* binary address */
+	struct	addrinfo *ai_next;	/* next structure in linked list */
 };
+#pragma clang diagnostic pop
 
 /*
  * Error return codes from gethostbyname() and gethostbyaddr()