]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip: Convert non-constant initializers to macros
authorPetr Machata <petrm@nvidia.com>
Tue, 31 May 2022 11:35:48 +0000 (13:35 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 1 Jun 2022 23:01:14 +0000 (16:01 -0700)
commit11e41a635cfab54e8e02fbff2a03715467e77ae9
tree59eb2f25124e8f96dd399d5730b798ca194c1682
parentb1521ec002e1d2c72404aa9e4d7734c541260a7c
ip: Convert non-constant initializers to macros

As per the C standard, "expressions in an initializer for an object that
has static or thread storage duration shall be constant expressions".
Aggregate objects are not constant expressions. Newer GCC doesn't mind, but
older GCC and LLVM do.

Therefore convert to a macro. And since all these macros will look very
similar, extract a generic helper, IPSTATS_STAT_DESC_XSTATS_LEAF, which
takes the leaf name as an argument and initializes the rest as appropriate
for an xstats descriptor.

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ip_common.h
ip/iplink_bond.c
ip/iplink_bridge.c