﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
207	include/sys/cdefs.h needs updating for GCC 4.x	psmedley	bird	"With the included cdefs.h, GCC 4.x breaks when building the JS code in mozilla with an error 'error: array bound is not 
an integer constant'

The problem comes from mozilla includes that use offsetof

cdefs.h needs to be updated for GCC 4.x, the following diff based on updated BSD headers fixes the problem:
{{{
--- u:\usr\include\sys\cdefs.h	2009-01-18 18:54:06.000000000 +0945
+++ u:\usr\local432\include\sys\cdefs.h	2009-01-18 18:55:24.000000000 +0945
@@ -251,9 +251,21 @@
  * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  * require it.
  */
-#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
-#define	__rangeof(type, start, end) \
-	(__offsetof(type, end) - __offsetof(type, start))
+#if __GNUC_PREREQ__(4, 1)
+#define __offsetof(type, field)  __builtin_offsetof(type, field)
+#else
+#ifndef __cplusplus
+#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
+#else
+#define __offsetof(type, field)                                 \
+  (__offsetof__ (reinterpret_cast <size_t>                      \
+                 (&reinterpret_cast <const volatile char &>     \
+                  (static_cast<type *> (0)->field))))
+#endif
+#endif
+#define __rangeof(type, start, end) \
+         (__offsetof(type, end) - __offsetof(type, start))
+
 
 /*
  * Compiler-dependent macros to declare that functions take printf-like
}}}"	defect	closed	normal	libc-0.6.4	libc	0.6.2	normal	fixed		
