On Mon, Oct 15, 2012 at 9:15 AM, Sean McBride <s...@rogue-research.com>wrote:
> On Fri, 12 Oct 2012 23:25:14 +0100, Pete Batard said:
>
> >On 2012.10.12 22:06, Sean McBride wrote:
> >> 3) ???
> >
> >3) Look at how other software that uses -Wcast-align handles the same
> issue.
> >
> >There's probably hardly any piece of significant C code out there that's
> >not going to cast a char* to struct*, so, if any has switched to using
> >-Wcast-align, we might as well learn from them.
>
> I'm not exactly sure what you're asking... I looked around a bit, and
> other projects seem to respond to -Wcast-align warnings with everything
> from disabling the warnings to fixing their code.
>
> If you're asking what the rationale of -Wcast-align is, I found two great
> texts:
>
> <
> https://www.securecoding.cert.org/confluence/display/seccode/EXP36-C.+Do+not+convert+pointers+into+more+strictly+aligned+pointer+types
> >
>
> <http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html>
>
> But, like I said in my first post, for the moment anyway, I'm not
> interested in trying to get all of libusbx to build cleanly with
> -Wcast-align.
>
> Would you accept a patch with my solution #1, again:
>
> 1) making libusb_control_transfer_get_setup not inline, so it's iffy cast
> is hidden in a .c file
>
That should wait for the next API break as it would change the binary
interface.
I'd suggest implementing it as a #define and punting the problem to the
caller.
Another solution would be our unpopular friend, the anonymous union for the
transfer buffer.
Orin.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel