Eliminate __attribute__ ((packed)) warnings for gcc-4.1
Subsystems (3)
PATCH 1/3 Eliminate __attribute__ ((packed)) warnings for gcc-4.1
Since version 4.1 the gcc is warning about ignored attributes. This patch is using the equivalent attribute on the struct instead of on each of the structure or union members.
GCC Manual:
"Specifying Attributes of Types
packed
This attribute, attached to struct or union type definition, specifies that
each member of the structure or union is placed to minimize the memory required. When attached to an enum definition, it indicates that the smallest integral type should be used.
Specifying this attribute for struct and union types is equivalent to specifying the packed attribute on each of the structure or union members."
drivers/isdn/hisax/hisax.h | 20 ++--- drivers/isdn/hisax/hisax_fcpcipnp.h | 18 ++--- drivers/net/3c527.h | 50 +++++++------- drivers/net/irda/vlsi_ir.h | 4 - drivers/net/wan/sdla.c | 6 - include/asm-i386/mpspec_def.h | 4 - include/linux/atalk.h | 18 ++--- include/linux/cycx_x25.h | 66 +++++++++--------- include/linux/if_frad.h | 12 +-- include/linux/isdnif.h | 70 ++++++++++---------- include/linux/ncp.h | 126 ++++++++++++++++++------------------ include/linux/sdla.h | 64 +++++++++--------- include/linux/wavefront.h | 34 ++++----- include/net/dn_dev.h | 80 +++++++++++----------- include/net/dn_nsp.h | 74 ++++++++++----------- include/sound/wavefront.h | 34 ++++----- 16 files changed, 340 insertions(+), 340 deletions(-)
include/asm-i386/mpspec_def.h +2 -2
@@ -75,8 +75,8 @@ struct mpc_config_bus {unsigned char mpc_type;unsigned char mpc_busid; - unsigned char mpc_bustype[6] __attribute((packed)); -}; +unsigned char mpc_bustype[6 ]; +} __attribute((packed));/* List of Bus Type string values, Intel MP Spec. */ #define BUSTYPE_EISA "EISA"
include/linux/if_frad.h +6 -6
@@ -131,17 +131,17 @@ struct frad_conf/* these are the fields of an RFC 1490 header */ struct frhdr { -unsigned char control __attribute__((packed)); +unsigned char control;/* for IP packets, this can be the NLPID */ -unsigned char pad __attribute__((packed)); +unsigned char pad; -unsigned char NLPID __attribute__((packed)); -unsigned char OUI[3 ] __attribute__((packed)); -unsigned short PID __attribute__((packed)); +unsigned char NLPID; +unsigned char OUI[3 ]; +unsigned short PID;#define IP_NLPID pad -}; +} __attribute__((packed));/* see RFC 1490 for the definition of the following */ #define FRAD_I_UI 0x03
include/linux/isdnif.h +35 -35
78 lines not on this page · raw message
include/linux/ncp.h +63 -63
155 lines not on this page · raw message
drivers/isdn/hisax/hisax.h +10 -10
@@ -396,17 +396,17 @@ struct isar_hw {struct hdlc_stat_reg {#ifdef __BIG_ENDIAN -u_char fill __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char cmd __attribute__((packed)); -#else -u_char cmd __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char fill __attribute__((packed)); +u_char fill; +u_char mode; +u_char xml; +u_char cmd; +#else +u_char cmd; +u_char xml; +u_char mode; +u_char fill;#endif -}; +} __attribute__((packed)); struct hdlc_hw { union {
drivers/isdn/hisax/hisax_fcpcipnp.h +9 -9
@@ -12,17 +12,17 @@ enum {struct hdlc_stat_reg {#ifdef __BIG_ENDIAN -u_char fill __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char cmd __attribute__((packed)); +u_char fill; +u_char mode; +u_char xml; +u_char cmd;#else -u_char cmd __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char fill __attribute__((packed)); +u_char cmd; +u_char xml; +u_char mode; +u_char fill;#endif -}; +} __attribute__((packed));struct fritz_bcs {struct hisax_b_if b_if;
drivers/net/3c527.h +25 -25
68 lines not on this page · raw message
drivers/net/irda/vlsi_ir.h +2 -2
@@ -577,8 +577,8 @@ struct ring_descr_hw {struct {u8 addr_res[3 ];volatile u8 status;/* descriptor status */ - } rd_s __attribute__((packed)); - } rd_u __attribute((packed)); + } __attribute__((packed)) rd_s; + } __attribute((packed)) rd_u; } __attribute__ ((packed));#define rd_addr rd_u.addr
include/linux/atalk.h +9 -9
@@ -155,15 +155,15 @@ struct elapaarp {#define AARP_REQUEST 1#define AARP_REPLY 2#define AARP_PROBE 3 - __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_src_zero __attribute__ ((packed)); - __be16 pa_src_net __attribute__ ((packed)); - __u8 pa_src_node __attribute__ ((packed)); - __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_dst_zero __attribute__ ((packed)); - __be16 pa_dst_net __attribute__ ((packed)); - __u8 pa_dst_node __attribute__ ((packed)); -}; +__u8 hw_src[ETH_ALEN ]; +__u8 pa_src_zero; +__be16 pa_src_net; +__u8 pa_src_node; +__u8 hw_dst[ETH_ALEN ]; +__u8 pa_dst_zero; +__be16 pa_dst_net; +__u8 pa_dst_node; +} __attribute__ ((packed));static __inline__struct elapaarp *aarp_hdr (struct sk_buff *skb) {
include/linux/cycx_x25.h +33 -33
78 lines not on this page · raw message
include/linux/sdla.h +32 -32
78 lines not on this page · raw message
include/linux/wavefront.h +17 -17
@@ -434,22 +434,22 @@ typedef struct wf_multisample { } wavefront_multisample; typedef struct wf_alias { - INT16 OriginalSample __attribute__ ((packed)); + INT16 OriginalSample; - struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); - struct wf_sample_offset loopStartOffset __attribute__ ((packed)); - struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); - struct wf_sample_offset loopEndOffset __attribute__ ((packed)); - - INT16 FrequencyBias __attribute__ ((packed)); - - UCHAR8 SampleResolution:2 __attribute__ ((packed)); - UCHAR8 Unused1:1 __attribute__ ((packed)); - UCHAR8 Loop:1 __attribute__ ((packed)); - UCHAR8 Bidirectional:1 __attribute__ ((packed)); - UCHAR8 Unused2:1 __attribute__ ((packed)); - UCHAR8 Reverse:1 __attribute__ ((packed)); - UCHAR8 Unused3:1 __attribute__ ((packed)); + struct wf_sample_offset sampleStartOffset; + struct wf_sample_offset loopStartOffset; + struct wf_sample_offset sampleEndOffset; + struct wf_sample_offset loopEndOffset; + + INT16 FrequencyBias; + + UCHAR8 SampleResolution:2; + UCHAR8 Unused1:1; + UCHAR8 Loop:1; + UCHAR8 Bidirectional:1; + UCHAR8 Unused2:1; + UCHAR8 Reverse:1; + UCHAR8 Unused3:1; /* This structure is meant to be padded only to 16 bits on their original. Of course, whoever wrote their documentation didn't
@@ -460,8 +460,8 @@ typedef struct wf_alias {standard 16->32 bit issues. */ - UCHAR8 sixteen_bit_padding __attribute__ ((packed)); -} wavefront_alias; +UCHAR8 sixteen_bit_padding; +} __attribute__((packed)) wavefront_alias; typedef struct wf_drum { UCHAR8 PatchNumber;
include/net/dn_dev.h +40 -40
97 lines not on this page · raw message
drivers/net/wan/sdla.c +3 -3
@@ -329,9 +329,9 @@ static int sdla_cpuspeed(struct net_devistruct _dlci_stat { -short dlci __attribute__((packed)); -char flags __attribute__((packed)); -}; +short dlci; +char flags; +} __attribute__((packed));struct _frad_stat {
include/net/dn_nsp.h +37 -37
115 lines not on this page · raw message
include/sound/wavefront.h +17 -17
@@ -454,22 +454,22 @@ typedef struct wf_multisample { } wavefront_multisample; typedef struct wf_alias { - s16 OriginalSample __attribute__ ((packed)); + s16 OriginalSample; - struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); - struct wf_sample_offset loopStartOffset __attribute__ ((packed)); - struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); - struct wf_sample_offset loopEndOffset __attribute__ ((packed)); - - s16 FrequencyBias __attribute__ ((packed)); - - u8 SampleResolution:2 __attribute__ ((packed)); - u8 Unused1:1 __attribute__ ((packed)); - u8 Loop:1 __attribute__ ((packed)); - u8 Bidirectional:1 __attribute__ ((packed)); - u8 Unused2:1 __attribute__ ((packed)); - u8 Reverse:1 __attribute__ ((packed)); - u8 Unused3:1 __attribute__ ((packed)); + struct wf_sample_offset sampleStartOffset; + struct wf_sample_offset loopStartOffset; + struct wf_sample_offset sampleEndOffset; + struct wf_sample_offset loopEndOffset; + + s16 FrequencyBias; + + u8 SampleResolution:2; + u8 Unused1:1; + u8 Loop:1; + u8 Bidirectional:1; + u8 Unused2:1; + u8 Reverse:1; + u8 Unused3:1; /* This structure is meant to be padded only to 16 bits on their original. Of course, whoever wrote their documentation didn't
@@ -480,8 +480,8 @@ typedef struct wf_alias {standard 16->32 bit issues. */ - u8 sixteen_bit_padding __attribute__ ((packed)); -} wavefront_alias; +u8 sixteen_bit_padding; +} __attribute__((packed)) wavefront_alias; typedef struct wf_drum { u8 PatchNumber;
Quoted 10 lines · Jan Blunck
typedef struct
T30_s{include/linux/isdnif.h +0
-8/* session parameters */ - __u8 resolution __attribute__ ((packed)); - __u8 rate __attribute__ ((packed)); - __u8 width __attribute__ ((packed)); - __u8 length __attribute__ ((packed)); - __u8 compression __attribute__ ((packed)); - __u8 ecm __attribute__ ((packed)); - __u8 binary __attribute__ ((packed)); - __u8 scantime __attribute__ ((packed));
include/linux/isdnif.h typedef struct setup_parm { · line 293
Quoted 10 lines
include/linux/isdnif.h +9
-1- __u8 id[FAXIDLEN] __attribute__ ((packed)); +__u8 resolution; +__u8 rate ; +__u8 width ; +__u8 length ; +__u8 compression ; +__u8 ecm ; +__u8 binary ; +__u8 scantime ; +__u8 id[FAXIDLEN ] ;
What's with the funky placement of ; ?
The rest of the struct looks sensible.
drivers/net/3c527.h line 71
Quoted 10 lines
drivers/net/3c527.h +4
-4/* various cruft */ - u32 dataA[6] __attribute((packed)); - u16 dataB[5] __attribute((packed)); - u32 dataC[14] __attribute((packed)); -}; +u32 dataA[6 ]; +u16 dataB[5 ]; +u32 dataC[14 ]; +} __attribute((packed));
You could fix the horked indentation at the same time. (This crops up in a few places in this diff)
Dave
Quoted 12 lines
include/linux/isdnif.h typedef struct setup_parm { · line 293
Quoted 8 lines
include/linux/isdnif.h +8
-0+__u8 rate ; +__u8 width ; +__u8 length ; +__u8 compression ; +__u8 ecm ; +__u8 binary ; +__u8 scantime ; +__u8 id[FAXIDLEN ] ;What's with the funky placement of ; ?
The rest of the struct looks sensible.
Looks like a simple s/__attribute__((packed))// rather than s/\s+__attribute__((packed))/;
Quoted 5 lines · Jan Engelhardt
Quoted 3 lines
What's with the funky placement of ; ?
The rest of the struct looks sensible.Looks like a simple s/__attribute__((packed))// rather than s/\s+__attribute__((packed))/;
Yeah, seems that I was too lazy. I'll do better next time ;)
Andrew, I'll resend a whitespace-beautified version.
Regards,
Jan
Signature · 4 lines
Jan Blunck [email protected] SuSE LINUX - A Novell company Maxfeldstr. 5 +49-911-74053-608 D-90409 Nürnberg http://www.suse.de
Eliminate __attribute__ ((packed)) warnings for gcc-4.1 (whitespace-beautified version)
In reply to Jan EngelhardtSince version 4.1 the gcc is warning about ignored attributes. This patch is using the equivalent attribute on the struct instead of on each of the structure or union members.
GCC Manual:
"Specifying Attributes of Types
packed
This attribute, attached to struct or union type definition, specifies that
each member of the structure or union is placed to minimize the memory required. When attached to an enum definition, it indicates that the smallest integral type should be used.
Specifying this attribute for struct and union types is equivalent to specifying the packed attribute on each of the structure or union members."
drivers/isdn/hisax/hisax.h | 20 ++--- drivers/isdn/hisax/hisax_fcpcipnp.h | 18 ++--- drivers/net/3c527.h | 50 +++++++------- drivers/net/irda/vlsi_ir.h | 4 - drivers/net/wan/sdla.c | 6 - include/asm-i386/mpspec_def.h | 4 - include/linux/atalk.h | 18 ++--- include/linux/cycx_x25.h | 66 +++++++++--------- include/linux/if_frad.h | 12 +-- include/linux/isdnif.h | 70 ++++++++++---------- include/linux/ncp.h | 126 ++++++++++++++++++------------------ include/linux/sdla.h | 64 +++++++++--------- include/linux/wavefront.h | 34 ++++----- include/net/dn_dev.h | 84 ++++++++++++------------ include/net/dn_nsp.h | 74 ++++++++++----------- include/sound/wavefront.h | 34 ++++----- 16 files changed, 342 insertions(+), 342 deletions(-)
include/asm-i386/mpspec_def.h +2 -2
@@ -75,8 +75,8 @@ struct mpc_config_bus {unsigned char mpc_type;unsigned char mpc_busid; - unsigned char mpc_bustype[6] __attribute((packed)); -}; +unsigned char mpc_bustype[6 ]; +} __attribute((packed));/* List of Bus Type string values, Intel MP Spec. */ #define BUSTYPE_EISA "EISA"
include/linux/if_frad.h +6 -6
@@ -131,17 +131,17 @@ struct frad_conf/* these are the fields of an RFC 1490 header */ struct frhdr { -unsigned char control __attribute__((packed)); +unsigned char control;/* for IP packets, this can be the NLPID */ -unsigned char pad __attribute__((packed)); +unsigned char pad; -unsigned char NLPID __attribute__((packed)); -unsigned char OUI[3 ] __attribute__((packed)); -unsigned short PID __attribute__((packed)); +unsigned char NLPID; +unsigned char OUI[3 ]; +unsigned short PID;#define IP_NLPID pad -}; +} __attribute__((packed));/* see RFC 1490 for the definition of the following */ #define FRAD_I_UI 0x03
include/linux/isdnif.h +35 -35
78 lines not on this page · raw message
include/linux/ncp.h +63 -63
155 lines not on this page · raw message
drivers/isdn/hisax/hisax.h +10 -10
@@ -396,17 +396,17 @@ struct isar_hw {struct hdlc_stat_reg {#ifdef __BIG_ENDIAN -u_char fill __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char cmd __attribute__((packed)); -#else -u_char cmd __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char fill __attribute__((packed)); +u_char fill; +u_char mode; +u_char xml; +u_char cmd; +#else +u_char cmd; +u_char xml; +u_char mode; +u_char fill;#endif -}; +} __attribute__((packed)); struct hdlc_hw { union {
drivers/isdn/hisax/hisax_fcpcipnp.h +9 -9
@@ -12,17 +12,17 @@ enum {struct hdlc_stat_reg {#ifdef __BIG_ENDIAN -u_char fill __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char cmd __attribute__((packed)); +u_char fill; +u_char mode; +u_char xml; +u_char cmd;#else -u_char cmd __attribute__((packed)); -u_char xml __attribute__((packed)); -u_char mode __attribute__((packed)); -u_char fill __attribute__((packed)); +u_char cmd; +u_char xml; +u_char mode; +u_char fill;#endif -}; +} __attribute__((packed));struct fritz_bcs {struct hisax_b_if b_if;
drivers/net/3c527.h +25 -25
68 lines not on this page · raw message
drivers/net/irda/vlsi_ir.h +2 -2
@@ -577,8 +577,8 @@ struct ring_descr_hw {struct {u8 addr_res[3 ];volatile u8 status;/* descriptor status */ - } rd_s __attribute__((packed)); - } rd_u __attribute((packed)); + } __attribute__((packed)) rd_s; + } __attribute((packed)) rd_u; } __attribute__ ((packed));#define rd_addr rd_u.addr
include/linux/atalk.h +9 -9
@@ -155,15 +155,15 @@ struct elapaarp {#define AARP_REQUEST 1#define AARP_REPLY 2#define AARP_PROBE 3 - __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_src_zero __attribute__ ((packed)); - __be16 pa_src_net __attribute__ ((packed)); - __u8 pa_src_node __attribute__ ((packed)); - __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_dst_zero __attribute__ ((packed)); - __be16 pa_dst_net __attribute__ ((packed)); - __u8 pa_dst_node __attribute__ ((packed)); -}; +__u8 hw_src[ETH_ALEN ]; +__u8 pa_src_zero; +__be16 pa_src_net; +__u8 pa_src_node; +__u8 hw_dst[ETH_ALEN ]; +__u8 pa_dst_zero; +__be16 pa_dst_net; +__u8 pa_dst_node; +} __attribute__ ((packed));static __inline__struct elapaarp *aarp_hdr (struct sk_buff *skb) {
include/linux/cycx_x25.h +33 -33
78 lines not on this page · raw message
include/linux/sdla.h +32 -32
78 lines not on this page · raw message
include/linux/wavefront.h +17 -17
@@ -434,22 +434,22 @@ typedef struct wf_multisample { } wavefront_multisample; typedef struct wf_alias { - INT16 OriginalSample __attribute__ ((packed)); + INT16 OriginalSample; - struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); - struct wf_sample_offset loopStartOffset __attribute__ ((packed)); - struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); - struct wf_sample_offset loopEndOffset __attribute__ ((packed)); - - INT16 FrequencyBias __attribute__ ((packed)); - - UCHAR8 SampleResolution:2 __attribute__ ((packed)); - UCHAR8 Unused1:1 __attribute__ ((packed)); - UCHAR8 Loop:1 __attribute__ ((packed)); - UCHAR8 Bidirectional:1 __attribute__ ((packed)); - UCHAR8 Unused2:1 __attribute__ ((packed)); - UCHAR8 Reverse:1 __attribute__ ((packed)); - UCHAR8 Unused3:1 __attribute__ ((packed)); + struct wf_sample_offset sampleStartOffset; + struct wf_sample_offset loopStartOffset; + struct wf_sample_offset sampleEndOffset; + struct wf_sample_offset loopEndOffset; + + INT16 FrequencyBias; + + UCHAR8 SampleResolution:2; + UCHAR8 Unused1:1; + UCHAR8 Loop:1; + UCHAR8 Bidirectional:1; + UCHAR8 Unused2:1; + UCHAR8 Reverse:1; + UCHAR8 Unused3:1; /* This structure is meant to be padded only to 16 bits on their original. Of course, whoever wrote their documentation didn't
@@ -460,8 +460,8 @@ typedef struct wf_alias {standard 16->32 bit issues. */ - UCHAR8 sixteen_bit_padding __attribute__ ((packed)); -} wavefront_alias; +UCHAR8 sixteen_bit_padding; +} __attribute__((packed)) wavefront_alias; typedef struct wf_drum { UCHAR8 PatchNumber;
include/net/dn_dev.h +42 -42
107 lines not on this page · raw message
drivers/net/wan/sdla.c +3 -3
@@ -329,9 +329,9 @@ static int sdla_cpuspeed(struct net_devistruct _dlci_stat { -short dlci __attribute__((packed)); -char flags __attribute__((packed)); -}; +short dlci; +char flags; +} __attribute__((packed));struct _frad_stat {
include/net/dn_nsp.h +37 -37
115 lines not on this page · raw message
include/sound/wavefront.h +17 -17
@@ -454,22 +454,22 @@ typedef struct wf_multisample { } wavefront_multisample; typedef struct wf_alias { - s16 OriginalSample __attribute__ ((packed)); + s16 OriginalSample; - struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); - struct wf_sample_offset loopStartOffset __attribute__ ((packed)); - struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); - struct wf_sample_offset loopEndOffset __attribute__ ((packed)); - - s16 FrequencyBias __attribute__ ((packed)); - - u8 SampleResolution:2 __attribute__ ((packed)); - u8 Unused1:1 __attribute__ ((packed)); - u8 Loop:1 __attribute__ ((packed)); - u8 Bidirectional:1 __attribute__ ((packed)); - u8 Unused2:1 __attribute__ ((packed)); - u8 Reverse:1 __attribute__ ((packed)); - u8 Unused3:1 __attribute__ ((packed)); + struct wf_sample_offset sampleStartOffset; + struct wf_sample_offset loopStartOffset; + struct wf_sample_offset sampleEndOffset; + struct wf_sample_offset loopEndOffset; + + s16 FrequencyBias; + + u8 SampleResolution:2; + u8 Unused1:1; + u8 Loop:1; + u8 Bidirectional:1; + u8 Unused2:1; + u8 Reverse:1; + u8 Unused3:1; /* This structure is meant to be padded only to 16 bits on their original. Of course, whoever wrote their documentation didn't
@@ -480,8 +480,8 @@ typedef struct wf_alias {standard 16->32 bit issues. */ - u8 sixteen_bit_padding __attribute__ ((packed)); -} wavefront_alias; +u8 sixteen_bit_padding; +} __attribute__((packed)) wavefront_alias; typedef struct wf_drum { u8 PatchNumber;