diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2020-04-15 18:15:58 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2020-04-15 18:15:58 +0000 |
commit | 6671366a55357f11c18837b10d53f8884e7a1251 (patch) | |
tree | bf2114b05e2a9e4970aaf5b5ee729c2db0c2d1b8 /lib/libc/net | |
parent | 1565e1889abcc168d751158a9ad9bf8e4095f9e6 (diff) |
Fix -Wvoid-pointer-to-enum-cast warnings.
This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless. Silence the warning
by casting through uintptr_t.
This warning is on by default in Clang 11.
Reviewed by: arichardson
Obtained from: CheriBSD (partial)
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425
Notes
Notes:
svn path=/head/; revision=359978
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/gethostnamadr.c | 6 | ||||
-rw-r--r-- | lib/libc/net/getnetnamadr.c | 6 | ||||
-rw-r--r-- | lib/libc/net/getprotoent.c | 6 | ||||
-rw-r--r-- | lib/libc/net/getservent.c | 18 |
4 files changed, 18 insertions, 18 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index b0e68cf3431c..718a64defab9 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -177,7 +177,7 @@ host_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata) res_options = statp->options & (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | RES_NOALIASES | RES_USE_INET6); - lookup_type = (enum nss_lookup_type)cache_mdata; + lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata; switch (lookup_type) { case nss_lt_name: str = va_arg(ap, char *); @@ -268,7 +268,7 @@ host_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap, size_t desired_size, aliases_size, addr_size, size; char *p, **iter; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: str = va_arg(ap, char *); type = va_arg(ap, int); @@ -375,7 +375,7 @@ host_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap, char *orig_buf; size_t orig_buf_size; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: str = va_arg(ap, char *); type = va_arg(ap, int); diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c index 77773992123f..2d9776685cf9 100644 --- a/lib/libc/net/getnetnamadr.c +++ b/lib/libc/net/getnetnamadr.c @@ -70,7 +70,7 @@ net_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata) enum nss_lookup_type lookup_type; int res = NS_UNAVAIL; - lookup_type = (enum nss_lookup_type)cache_mdata; + lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata; switch (lookup_type) { case nss_lt_name: name = va_arg(ap, char *); @@ -133,7 +133,7 @@ net_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap, char *p; char **alias; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); break; @@ -221,7 +221,7 @@ net_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap, char *p; char **alias; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); break; diff --git a/lib/libc/net/getprotoent.c b/lib/libc/net/getprotoent.c index cde22564b995..73b069250499 100644 --- a/lib/libc/net/getprotoent.c +++ b/lib/libc/net/getprotoent.c @@ -97,7 +97,7 @@ __proto_id_func(char *buffer, size_t *buffer_size, va_list ap, enum nss_lookup_type lookup_type; int res = NS_UNAVAIL; - lookup_type = (enum nss_lookup_type)cache_mdata; + lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata; switch (lookup_type) { case nss_lt_name: name = va_arg(ap, char *); @@ -155,7 +155,7 @@ __proto_marshal_func(char *buffer, size_t *buffer_size, void *retval, char *p; char **alias; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); break; @@ -241,7 +241,7 @@ __proto_unmarshal_func(char *buffer, size_t buffer_size, void *retval, char *p; char **alias; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); break; diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c index 2e4f47bef664..76db40d96cf5 100644 --- a/lib/libc/net/getservent.c +++ b/lib/libc/net/getservent.c @@ -446,7 +446,7 @@ files_setservent(void *retval, void *mdata, va_list ap) if (rv != 0) return (NS_UNAVAIL); - switch ((enum constants)mdata) { + switch ((enum constants)(uintptr_t)mdata) { case SETSERVENT: f = va_arg(ap,int); if (st->fp == NULL) @@ -509,7 +509,7 @@ db_servent(void *retval, void *mdata, va_list ap) name = NULL; proto = NULL; - how = (enum nss_lookup_type)mdata; + how = (enum nss_lookup_type)(uintptr_t)mdata; switch (how) { case nss_lt_name: name = va_arg(ap, char *); @@ -626,7 +626,7 @@ db_setservent(void *retval, void *mdata, va_list ap) if (rv != 0) return (NS_UNAVAIL); - switch ((enum constants)mdata) { + switch ((enum constants)(uintptr_t)mdata) { case SETSERVENT: f = va_arg(ap, int); st->stayopen |= f; @@ -682,7 +682,7 @@ nis_servent(void *retval, void *mdata, va_list ap) name = NULL; proto = NULL; buf = NULL; - how = (enum nss_lookup_type)mdata; + how = (enum nss_lookup_type)(uintptr_t)mdata; switch (how) { case nss_lt_name: name = va_arg(ap, char *); @@ -814,7 +814,7 @@ nis_setservent(void *result, void *mdata, va_list ap) if (rv != 0) return (NS_UNAVAIL); - switch ((enum constants)mdata) { + switch ((enum constants)(uintptr_t)mdata) { case SETSERVENT: case ENDSERVENT: free(st->yp_key); @@ -850,7 +850,7 @@ compat_setservent(void *retval, void *mdata, va_list ap) (void)files_setservent(retval, mdata, ap); - switch ((enum constants)mdata) { + switch ((enum constants)(uintptr_t)mdata) { case SETSERVENT: f = va_arg(ap,int); (void)nsdispatch(retval, compat_dtab, NSDB_SERVICES_COMPAT, @@ -879,7 +879,7 @@ serv_id_func(char *buffer, size_t *buffer_size, va_list ap, void *cache_mdata) enum nss_lookup_type lookup_type; int res = NS_UNAVAIL; - lookup_type = (enum nss_lookup_type)cache_mdata; + lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata; switch (lookup_type) { case nss_lt_name: name = va_arg(ap, char *); @@ -961,7 +961,7 @@ serv_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap, size_t size; size_t aliases_size; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); proto = va_arg(ap, char *); @@ -1058,7 +1058,7 @@ serv_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap, size_t orig_buf_size; int *ret_errno; - switch ((enum nss_lookup_type)cache_mdata) { + switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) { case nss_lt_name: name = va_arg(ap, char *); proto = va_arg(ap, char *); |