nla_policy results in "sorry, unimplemented: non-trivial designated initializers not supported" during compile

David Ahern dsa at cumulusnetworks.com
Thu Jul 21 16:25:45 PDT 2016


On 7/21/16 5:02 PM, Avery Rozar wrote:
> For example in info.c from "iw" they build an nla_policy freq_policy[]
> like this..
>
> static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
>    [NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
>    [NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG },
>    [NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG },
>    [__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
>    [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
>    [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
> };
>
> Is the ".type" in "{ .type = NLA_U32 }" defined by "uint16_t type"?
> Also the compile error points to the end of this freq_policy array. Is
> it because I'm using a c file as an example and this would need to be
> coded differently in c++?

you mean this error:
$ g++ -I/usr/include/libnl3/ -c nl-ex.c
nl-ex.c: In function ‘int main()’:
nl-ex.c:14:2: sorry, unimplemented: non-trivial designated initializers 
not supported
   };
   ^
nl-ex.c:14:2: sorry, unimplemented: non-trivial designated initializers 
not supported
nl-ex.c:14:2: sorry, unimplemented: non-trivial designated initializers 
not supported
nl-ex.c:14:2: sorry, unimplemented: non-trivial designated initializers 
not supported
nl-ex.c:14:2: sorry, unimplemented: non-trivial designated initializers 
not supported

gcc is fine with it; g++ not.

Perhaps the C++ version needs to be implemented differently:

http://stackoverflow.com/questions/31215971/non-trivial-designated-initializers-not-supported



More information about the libnl mailing list