This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiling glibc-2.3.2 with gcc-3.4 yields "string2.h:80: warning: `packed' attribute ignored"
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Dan Kegel <dank at kegel dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 19 Aug 2003 15:51:05 -0700
- Subject: Re: Compiling glibc-2.3.2 with gcc-3.4 yields "string2.h:80: warning: `packed' attribute ignored"
- References: <3F3C2B98.6000202@kegel.com>
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