Can the empty struct rte_eth_txmode be enhanced?
lxu
Acked-by Olivier MatzGreat! Thanks for the quick feedback.
------------------ Original ------------------
From: "Olivier MATZ"<[email protected]>; Date: Wed, Jun 12, 2013 05:17 PM To: "dev"<[email protected]>;
Cc: "lxu"<[email protected]>;
Subject: Re: [dpdk-dev] Can the empty struct rte_eth_txmode be enhanced?
Hello,
Quoted 5 lines
Can we change the struct
rte_eth_txmode?Such as :
struct
rte_eth_txmode{ int reserve[]; }; /*sizeof(struct rte_eth_txmode)== 0 in gcc and g++ */
I agree with your solution. Do you approve the following patch ?
From: lxu <[email protected]>
Date: Wed, 12 Jun 2013 09:32:30 +0200
Subject: [PATCH] ethdev: force the size of struct rte_eth_txmode to be 0
The size of an empty structure is 0 when compiling with gcc, and 1 when compiling with g++. Adding an empty table forces the size fo be 0, in C or C++.
--- lib/librte_ether/rte_ethdev.h | 1 + 1 file changed, 1 insertion(+)
lib/librte_ether/rte_ethdev.h +1 -0
@@ -320,6 +320,7 @@ struct rte_eth_vmdq_dcb_conf {* For future extensions. */ struct rte_eth_txmode { +int reserved[];/* force the size of struct to be 0 */ };/**
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Monjalon
Applied12/06/2013 14:23, lxu :
Quoted 10 lines
Great! Thanks for the quick feedback.
------------------ Original ------------------
From: "Olivier MATZ"<[email protected]>;I agree with your solution. Do you approve the following patch ?
From: lxu <[email protected]>
Date: Wed, 12 Jun 2013 09:32:30 +0200
Subject: [PATCH] ethdev: force the size of structrte_eth_txmodeto be 0
applied, thanks
Signature · 1 line
Thomas
A message that is not in the archive (sent off-list or not yet received): 201306121539.49552.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
PATCH 1/1 ethdev: fix empty struct rte_eth_txmode
The previous fix was for g++ but is broken with gcc:
error: flexible array member in otherwise empty struct
See http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Zero-Length.html
Let's fix it with #ifdef __cplusplus.
--- lib/librte_ether/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ether/rte_ethdev.h +2 -0
@@ -320,7 +320,9 @@ struct rte_eth_vmdq_dcb_conf {* For future extensions. */ struct rte_eth_txmode { +#ifdef __cplusplusint reserved[];/* force size of struct to be 0 */ +#endif };/**
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): 1371047405-29432-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
Re: [PATCH] ethdev: fix empty struct rte_eth_txmode
Quoted 5 lines · Thomas Monjalon
The previous fix was for g++ but is broken with gcc:
error: flexible array member in otherwise empty struct
See http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Zero-Length.htmlLet's fix it with #ifdef
__cplusplus.
Sorry Thomas for the previous one, I should have tested it.
This one looks good, I checked compilation and it works with gcc-4.6.3 and g++-4.6.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH] ethdev: fix empty struct rte_eth_txmode
12/06/2013 16:46, Olivier MATZ :
Quoted 5 lines · Thomas Monjalon
Quoted 2 lines
The previous fix was for g++ but is broken with gcc:
error: flexible array member in otherwise empty structSorry Thomas for the previous one, I should have tested it.
No problem, I should also better test before pushing :)
Quoted 2 lines
This one looks good, I checked compilation and it works with gcc-4.6.3 and g++-4.6.3
pushed
Signature · 1 line
Thomas