This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling glibc-2.3.2 with gcc-3.4 yields "string2.h:80: warning: `packed' attribute ignored"


Dan Kegel wrote:
# define __STRING2_COPY_TYPE(N) \
typedef struct { unsigned char __arr[N]; } \
__STRING2_COPY_ARR##N __attribute__ ((packed))

This looks like a glibc problem. The syntax for typedef is roughly
typedef <type> <name>;
glibc put the attribute at the end, which means it is after <name>, but attaching a packed attribute to a name is useless, and hence it is being ignored. If you want the packed attribute to do something, it needs to be attached to <type> intead of <name>.


It looks like the only change here is that gcc used to silently ignore the misplaced attribute, and is now warning about it which is an improvement. Trying gcc-3.2, I get no warning, and the struct is not packed either.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]