svn commit: r360414 - in stable/12: lib/libc/gen lib/libc/net lib/libc/rpc sys/dev/ocs_fc sys/net80211
Brooks Davis
brooks at FreeBSD.org
Mon Apr 27 23:47:42 UTC 2020
Author: brooks
Date: Mon Apr 27 23:47:40 2020
New Revision: 360414
URL: https://svnweb.freebsd.org/changeset/base/360414
Log:
MFC r359978:
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)
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425
Modified:
stable/12/lib/libc/gen/getgrent.c
stable/12/lib/libc/gen/getpwent.c
stable/12/lib/libc/net/gethostnamadr.c
stable/12/lib/libc/net/getnetnamadr.c
stable/12/lib/libc/net/getprotoent.c
stable/12/lib/libc/net/getservent.c
stable/12/lib/libc/rpc/getrpcent.c
stable/12/sys/dev/ocs_fc/ocs_device.c
stable/12/sys/net80211/ieee80211_output.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/lib/libc/gen/getgrent.c
==============================================================================
--- stable/12/lib/libc/gen/getgrent.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/gen/getgrent.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -166,7 +166,7 @@ grp_id_func(char *buffer, size_t *buffer_size, va_list
enum nss_lookup_type lookup_type;
- 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 *);
@@ -220,7 +220,7 @@ grp_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size, mem_size;
char *p, **mem;
- 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;
@@ -315,7 +315,7 @@ grp_unmarshal_func(char *buffer, size_t buffer_size, v
char *p;
char **mem;
- 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;
@@ -804,7 +804,7 @@ files_setgrent(void *retval, void *mdata, va_list ap)
rv = files_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata) {
+ switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -841,7 +841,7 @@ files_group(void *retval, void *mdata, va_list ap)
fresh = 0;
name = NULL;
gid = (gid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1094,7 +1094,7 @@ nis_group(void *retval, void *mdata, va_list ap)
name = NULL;
gid = (gid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1253,7 +1253,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap)
rv = compat_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata) {
+ switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -1322,7 +1322,7 @@ compat_group(void *retval, void *mdata, va_list ap)
fresh = 0;
name = NULL;
gid = (gid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
Modified: stable/12/lib/libc/gen/getpwent.c
==============================================================================
--- stable/12/lib/libc/gen/getpwent.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/gen/getpwent.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -213,7 +213,7 @@ pwd_id_func(char *buffer, size_t *buffer_size, va_list
int res = NS_UNAVAIL;
enum nss_lookup_type lookup_type;
- 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 *);
@@ -267,7 +267,7 @@ pwd_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size;
char *p;
- 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;
@@ -370,7 +370,7 @@ pwd_unmarshal_func(char *buffer, size_t buffer_size, v
char *p;
- 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;
@@ -764,7 +764,7 @@ files_setpwent(void *retval, void *mdata, va_list ap)
rv = files_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata) {
+ switch ((enum constants)(uintptr_t)mdata) {
case SETPWENT:
stayopen = va_arg(ap, int);
st->keynum = 0;
@@ -802,7 +802,7 @@ files_passwd(void *retval, void *mdata, va_list ap)
name = NULL;
uid = (uid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1294,7 +1294,7 @@ nis_passwd(void *retval, void *mdata, va_list ap)
name = NULL;
uid = (uid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1693,7 +1693,7 @@ compat_setpwent(void *retval, void *mdata, va_list ap)
rv = compat_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata) {
+ switch ((enum constants)(uintptr_t)mdata) {
case SETPWENT:
stayopen = va_arg(ap, int);
st->keynum = 0;
@@ -1740,7 +1740,7 @@ compat_passwd(void *retval, void *mdata, va_list ap)
from_compat = 0;
name = NULL;
uid = (uid_t)-1;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
Modified: stable/12/lib/libc/net/gethostnamadr.c
==============================================================================
--- stable/12/lib/libc/net/gethostnamadr.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/net/gethostnamadr.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -177,7 +177,7 @@ host_id_func(char *buffer, size_t *buffer_size, va_lis
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, v
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,
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);
Modified: stable/12/lib/libc/net/getnetnamadr.c
==============================================================================
--- stable/12/lib/libc/net/getnetnamadr.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/net/getnetnamadr.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -70,7 +70,7 @@ net_id_func(char *buffer, size_t *buffer_size, va_list
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, vo
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, v
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;
Modified: stable/12/lib/libc/net/getprotoent.c
==============================================================================
--- stable/12/lib/libc/net/getprotoent.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/net/getprotoent.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -97,7 +97,7 @@ __proto_id_func(char *buffer, size_t *buffer_size, va_
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
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_siz
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;
Modified: stable/12/lib/libc/net/getservent.c
==============================================================================
--- stable/12/lib/libc/net/getservent.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/net/getservent.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -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 a
(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_lis
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, v
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,
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 *);
Modified: stable/12/lib/libc/rpc/getrpcent.c
==============================================================================
--- stable/12/lib/libc/rpc/getrpcent.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/lib/libc/rpc/getrpcent.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -227,7 +227,7 @@ files_rpcent(void *retval, void *mdata, va_list ap)
int stayopen;
enum nss_lookup_type how;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how)
{
case nss_lt_name:
@@ -347,7 +347,7 @@ files_setrpcent(void *retval, void *mdata, va_list ap)
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata)
+ switch ((enum constants)(uintptr_t)mdata)
{
case SETRPCENT:
f = va_arg(ap,int);
@@ -407,7 +407,7 @@ nis_rpcent(void *retval, void *mdata, va_list ap)
enum nss_lookup_type how;
int no_name_active;
- how = (enum nss_lookup_type)mdata;
+ how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how)
{
case nss_lt_name:
@@ -584,7 +584,7 @@ nis_setrpcent(void *retval, void *mdata, va_list ap)
if (rv != 0)
return (NS_UNAVAIL);
- switch ((enum constants)mdata)
+ switch ((enum constants)(uintptr_t)mdata)
{
case SETRPCENT:
case ENDRPCENT:
@@ -611,7 +611,7 @@ rpc_id_func(char *buffer, size_t *buffer_size, va_list
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 *);
@@ -668,7 +668,7 @@ rpc_marshal_func(char *buffer, size_t *buffer_size, vo
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;
@@ -754,7 +754,7 @@ rpc_unmarshal_func(char *buffer, size_t buffer_size, v
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;
Modified: stable/12/sys/dev/ocs_fc/ocs_device.c
==============================================================================
--- stable/12/sys/dev/ocs_fc/ocs_device.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/sys/dev/ocs_fc/ocs_device.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -1238,7 +1238,7 @@ __ocs_d_wait_topology_notify(ocs_sm_ctx_t *ctx, ocs_sm
break;
case OCS_EVT_SPORT_TOPOLOGY_NOTIFY: {
- ocs_sport_topology_e topology = (ocs_sport_topology_e)arg;
+ ocs_sport_topology_e topology = (ocs_sport_topology_e)(uintptr_t)arg;
ocs_assert(!node->sport->domain->attached, NULL);
ocs_assert(node->send_ls_acc == OCS_NODE_SEND_LS_ACC_PLOGI, NULL);
node_printf(node, "topology notification, topology=%d\n", topology);
Modified: stable/12/sys/net80211/ieee80211_output.c
==============================================================================
--- stable/12/sys/net80211/ieee80211_output.c Mon Apr 27 23:43:17 2020 (r360413)
+++ stable/12/sys/net80211/ieee80211_output.c Mon Apr 27 23:47:40 2020 (r360414)
@@ -3245,7 +3245,7 @@ static void
ieee80211_tx_mgt_cb(struct ieee80211_node *ni, void *arg, int status)
{
struct ieee80211vap *vap = ni->ni_vap;
- enum ieee80211_state ostate = (enum ieee80211_state) arg;
+ enum ieee80211_state ostate = (enum ieee80211_state)(uintptr_t)arg;
/*
* Frame transmit completed; arrange timer callback. If
More information about the svn-src-stable
mailing list