Skip to content

Commit

Permalink
Revert "Use an unnamed variable instead of a named one"
Browse files Browse the repository at this point in the history
Fixes failures in the test suite when building in C++ mode.

This reverts commit fa4e7e9.

In file included from header_checker.cpp:6:
../include/usbg/function/net.h: In function ‘int usbg_f_net_get_dev_addr(usbg_f_net*, ether_addr*)’:
../include/usbg/usbg.h:61:16: error: taking address of rvalue [-fpermissive]
   61 |  ((union UNAME){ .FIELD = WHAT, })
      |  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
../include/usbg/function/net.h:51:2: note: in expansion of macro ‘USBG_TO_UNION’
   51 |  USBG_TO_UNION(usbg_f_net_attr_val, dev_addr, WHAT)
      |  ^~~~~~~~~~~~~
../include/usbg/function/net.h:131:12: note: in expansion of macro ‘USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL’
  131 |           &USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL(*addr));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/usbg/function/net.h: In function ‘int usbg_f_net_get_host_addr(usbg_f_net*, ether_addr*)’:
../include/usbg/usbg.h:61:16: error: taking address of rvalue [-fpermissive]
   61 |  ((union UNAME){ .FIELD = WHAT, })
      |  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
../include/usbg/function/net.h:51:2: note: in expansion of macro ‘USBG_TO_UNION’
   51 |  USBG_TO_UNION(usbg_f_net_attr_val, dev_addr, WHAT)
      |  ^~~~~~~~~~~~~
../include/usbg/function/net.h:157:12: note: in expansion of macro ‘USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL’
  157 |           &USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL(*addr));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Loading branch information
pabs3 committed Oct 26, 2021
1 parent 92deb97 commit d0f2f4f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/usbg/function/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ int usbg_f_net_set_attr_val(usbg_f_net *nf, enum usbg_f_net_attr attr,
static inline int usbg_f_net_get_dev_addr(usbg_f_net *nf,
struct ether_addr *addr)
{
return usbg_f_net_get_attr_val(nf, USBG_F_NET_DEV_ADDR,
&USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL(*addr));
union usbg_f_net_attr_val val = { .dev_addr = *addr, };
return usbg_f_net_get_attr_val(nf, USBG_F_NET_DEV_ADDR, &val);
}

/**
Expand All @@ -153,8 +153,8 @@ static inline int usbg_f_net_set_dev_addr(usbg_f_net *nf,
static inline int usbg_f_net_get_host_addr(usbg_f_net *nf,
struct ether_addr *addr)
{
return usbg_f_net_get_attr_val(nf, USBG_F_NET_HOST_ADDR,
&USBG_F_NET_ETHER_ADDR_TO_ATTR_VAL(*addr));
union usbg_f_net_attr_val val = { .host_addr = *addr, };
return usbg_f_net_get_attr_val(nf, USBG_F_NET_HOST_ADDR, &val);
}

/**
Expand Down

0 comments on commit d0f2f4f

Please sign in to comment.