There are now two remaining warnings.

Rob Landley rob at landley.net
Wed Sep 7 17:15:24 UTC 2005


On Wednesday 07 September 2005 09:14, Paul Fox wrote:
>  > Rob,
>  >
>  > >>/home/landley/busybox/busybox/networking/traceroute.c:296: warning:
>  > >> `align' attribute directive ignored
>  > >
>  > > Vladimir: you do traceroute?  (Why does it have that attribute in the
>  > > first place?)
>  >
>  > There was a message on a problem on unusual architecture.
>
> it was on an arm port -- see bug #45.  i applied the supplied patch,
> vodz shrieked in horror and suggested the __attribute__ instead.

I agree the original patch was hideous, but making the buf be 513 bytes and 
doing some variant of if(ptr&1) ptr++;  (With appropriate typecasts and 
parenthesization to make enlightened modern c99 compilers SHUT UP about 
it...)  Nice localized change which we can comment...

>  > The given correction has helped, but such message is similar on usual
>  > architecture stands out, because it is not required.
>  > I do not know what to do. Let remains as is?
>
> i think we have to deal with the warning.  can it be suppressed?

We don't _have_ to deal with the warning.  There are other options.

The __attribute__ is ugly, unintelligible to mere mortals, and above all 
throwing a warning.  (It's also compiler specific, but considering I'm 
willing to use gcc extensions like "x=(fred) ? : fred+1;" that's not a real 
objection, just adding insult to injury...)

That said, the __attribute__ could hidden in some sort of construct like:

#ifdef ARM
#define ALIGN_THIS_PUPPY  __attribute__ (thingy)
#else
#define ALIGN_THIS_PUPPY
#endif

typedef struct wossname ALIGN_THIS_PUPPY;

So that we only do the thing in circumstances where it actually is needed, 
rather than circumstances where it gives the compiler a rash.

P.S.  This is another candidate for a "quirks.h" file.  I really think it 
would be a good idea to centralize this sort of thing.  (Processor, compiler, 
and libc-specific hacks, above and beyond general endianness and 64 bit 
cleanliness issues.  Arm's inability to deal with unaligned access is just 
sad.  A sadness shared by early 68k processors, but sad nonetheless....)

Rob



More information about the busybox mailing list