__attribute__ placement
PATCH 1/1 __attribute__ placement
Hi,
The variable attributes "packed" and "align" when used with struct, should have the following order:
struct ... {...} __attribute__((packed)) var;
This patch fixes few instances where the variable and attributes are placed the other way around and had no affect.
Thanks
Vinay
asm-m68knommu/MC68328.h | 2 +- asm-m68knommu/MC68EZ328.h | 2 +- asm-m68knommu/MC68VZ328.h | 2 +- math-emu/double.h | 4 ++-- math-emu/extended.h | 2 +- math-emu/quad.h | 2 +- math-emu/single.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-)
===========================================================================
include/asm-m68knommu/MC68328.h +1 -1
@@ -993,7 +993,7 @@volatile unsigned short int pad1;volatile unsigned short int pad2;volatile unsigned short int pad3; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;/**********
include/asm-m68knommu/MC68EZ328.h +1 -1
@@ -815,7 +815,7 @@volatile unsigned short int nipr;volatile unsigned short int pad1;volatile unsigned short int pad2; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;/**********
include/asm-m68knommu/MC68VZ328.h +1 -1
@@ -909,7 +909,7 @@volatile unsigned short int nipr;volatile unsigned short int hmark;volatile unsigned short int unused; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;
include/math-emu/double.h +2 -2
@@ -67,7 +67,7 @@ unsigned exp : _FP_EXPBITS_D; unsigned sign : 1;#endif - } bits __attribute__((packed)); + } __attribute__((packed)) bits; };#define FP_DECL_D (X ) _FP_DECL(2,X)
@@ -139,7 +139,7 @@ unsigned exp : _FP_EXPBITS_D; unsigned sign : 1;#endif - } bits __attribute__((packed)); + } __attribute__((packed)) bits; };#define FP_DECL_D (X ) _FP_DECL(1,X)
include/math-emu/extended.h +1 -1
@@ -68,7 +68,7 @@ unsigned exp : _FP_EXPBITS_E; unsigned sign : 1;#endif /* not bigendian */ - } bits __attribute__((packed)); + } __attribute__((packed)) bits; };
include/math-emu/quad.h +1 -1
@@ -72,7 +72,7 @@ unsigned exp : _FP_EXPBITS_Q; unsigned sign : 1;#endif /* not bigendian */ - } bits __attribute__((packed)); + } __attribute__((packed)) bits; };
include/math-emu/single.h +1 -1
@@ -56,7 +56,7 @@ unsigned exp : _FP_EXPBITS_S; unsigned sign : 1;#endif - } bits __attribute__((packed)); + } __attribute__((packed)) bits; };#define FP_DECL_S (X ) _FP_DECL(1,X)
===========================================================================
Signature · 4 lines
Views expressed in this mail are those of the individual sender and do not bind Gsec1 Limited. or its subsidiary, unless the sender has done so expressly with due authority of Gsec1. _________________________________________________________________________
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Apparently my previous patch incorrectly fixed few cases where the problem didn't exist. The __attribute__((packed)) issue is applicable only to typedefed structs and the correct syntax for this should be:
typedef struct ... { ... } __attribute__((packed)) new_type;
Please find the updated patch. Hope I haven't introduced any new bugs.
Thanks
Vinay
drivers/net/gt96100eth.h | 4 ++-- include/asm-m68knommu/MC68328.h | 2 +- include/asm-m68knommu/MC68EZ328.h | 2 +- include/asm-m68knommu/MC68VZ328.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
=============================================================================
drivers/net/gt96100eth.h +2 -2
@@ -214,7 +214,7 @@u32 cmdstat;u32 next;u32 buff_ptr; -} gt96100_td_t __attribute__ ((packed)); +} __attribute__ ((packed)) gt96100_td_t; typedef struct { #ifdef DESC_BE
@@ -227,7 +227,7 @@u32 cmdstat;u32 next;u32 buff_ptr; -} gt96100_rd_t __attribute__ ((packed)); +} __attribute__ ((packed)) gt96100_rd_t;/* Values for the Tx command-status descriptor entry. */
include/asm-m68knommu/MC68328.h +1 -1
@@ -993,7 +993,7 @@volatile unsigned short int pad1;volatile unsigned short int pad2;volatile unsigned short int pad3; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;/**********
include/asm-m68knommu/MC68EZ328.h +1 -1
@@ -815,7 +815,7 @@volatile unsigned short int nipr;volatile unsigned short int pad1;volatile unsigned short int pad2; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;/**********
include/asm-m68knommu/MC68VZ328.h +1 -1
@@ -909,7 +909,7 @@volatile unsigned short int nipr;volatile unsigned short int hmark;volatile unsigned short int unused; -} m68328_uart __attribute__((packed)); +} __attribute__((packed)) m68328_uart;
=============================================================================
Quoted 11 lines · Vinay K Nallamothu
Quoted 10 lines
Hi,
The variable attributes "packed" and "align" when used with struct, should have the following order:
struct ... {...} __attribute__((packed)) var;
This patch fixes few instances where the variable and attributes are placed the other way around and had no affect.
Signature · 4 lines
Views expressed in this mail are those of the individual sender and do not bind Gsec1 Limited. or its subsidiary, unless the sender has done so expressly with due authority of Gsec1. _________________________________________________________________________