Friends -z

On Fri, Jan 11, 2008 at 12:04:40PM -0800, Larry Doolittle wrote:
> 
> On an amd64 Debian Sid, [chop] The strict-aliasing warning mysteriously
> disappears, and is replaced with 16 "warning: cast from pointer to
> integer of different size" (scary!) and a handful of "defined but not
> used".

Can we get rid of the silly home-made offsetof() in flags.c?
It's not even right on a 64-bit machine, where int and size_t
are different sizes.  Patch appended.  I don't know if it needs
autoconf magic for the #include <stddef.h>, or if there is any
point in keeping the old hack in the source code.

   - Larry

diff -ur /home/larry/cvs/pcb/src/flags.c pcb/src/flags.c
--- /home/larry/cvs/pcb/src/flags.c     2007-08-05 18:45:35.000000000 -0700
+++ pcb/src/flags.c     2008-01-11 12:44:01.000000000 -0800
@@ -30,6 +30,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -110,7 +111,11 @@
 #endif
 }
 
+#if 0
 #define OffsetOf(a,b) (int)(&(((a *)0)->b))
+#else
+#define OffsetOf(a,b) offsetof(a,b)
+#endif
 
 HID_Flag flags_flag_list[] = {
   {"style", FlagCurrentStyle, 0},


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to