[PATCH 1/3] Eliminate __attribute__ ((packed)) warnings for gcc-4.1

linux

[PATCH 1/3] Eliminate __attribute__ ((packed)) warnings for gcc-4.1

Postby Jan Blunck » Wed, 04 Jan 2006 20:40:21 GMT

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to  XXXX@XXXXX.COM 
More majordomo info at   http://www.**--****.com/ 
Please read the FAQ at   http://www.**--****.com/ 
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."

Signed-off-by: Jan Blunck < XXXX@XXXXX.COM >


Re: [PATCH 1/3] Eliminate __attribute__ ((packed)) warnings for gcc-4.1

Postby Dave Jones » Thu, 05 Jan 2006 11:30:14 GMT


 >  typedef struct T30_s {
 >  	/* 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));
 > -	__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.

 >  	
 >  	/* 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to  XXXX@XXXXX.COM 
More majordomo info at   http://www.**--****.com/ 
Please read the FAQ at   http://www.**--****.com/ 

Re: [PATCH 1/3] Eliminate __attribute__ ((packed)) warnings for gcc-4.1

Postby Jan Blunck » Thu, 05 Jan 2006 20:00:24 GMT




Yeah, seems that I was too lazy. I'll do better next time ;)

Andrew, I'll resend a whitespace-beautified version.

Regards,
	Jan

-- 
Jan Blunck                                                XXXX@XXXXX.COM 
SuSE LINUX - A Novell company
Maxfeldstr. 5                                          +49-911-74053-608
D-90409 Nnberg                                       http://www.**--****.com/ 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to  XXXX@XXXXX.COM 
More majordomo info at   http://www.**--****.com/ 
Please read the FAQ at   http://www.**--****.com/ 



Return to linux

 

Who is online

Users browsing this forum: No registered users and 95 guest