例如
typedef union
{
struct
{
unsigned fb_num : 8 __attribute__ ((packed));
unsigned stream_id : 12 __attribute__ ((packed));
unsigned lossless : 1 __attribute__ ((packed));
unsigned proto_idx : 6 __attribute__ ((packed));
unsigned da_logport : 13 __attribute__ ((packed));
unsigned sa_spare_dx : 10 __attribute__ ((packed));
unsigned da_spare_idx : 10 __attribute__ ((packed));
unsigned mcast_index : 12 __attribute__ ((packed));/* ISH_B*/
unsigned mesh_idx : 8 __attribute__ ((packed));
unsigned in_mirror : 4 __attribute__ ((packed));
unsigned vlan_idx : 12 __attribute__ ((packed));
unsigned dis_stp : 1 __attribute__ ((packed));
unsigned trkbal_idx : 5 __attribute__ ((packed));
...
我想排除此代码部分:__attribute__ ((packed))
,以便编译器将其读取为:
typedef union
{
struct
{
unsigned fb_num : 8 ;
unsigned stream_id : 12 ;
unsigned lossless : 1 ;
unsigned proto_idx : 6 ;
unsigned da_logport : 13 ;
unsigned sa_spare_dx : 10 ;
unsigned da_spare_idx : 10 ;
unsigned mcast_index : 12 ;/* ISH_B*/
unsigned mesh_idx : 8 ;
unsigned in_mirror : 4 ;
unsigned vlan_idx : 12 ;
unsigned dis_stp : 1 ;
unsigned trkbal_idx : 5 ;
...
现在应该编译的宏是MCAST_SIMULATION
:即如果MCAST_SIMULATION
已定义,则排除提到的代码部分,否则不排除。我怎样才能做到这一点?