2002-05-05 Bruno Haible <bruno@clisp.org>
+ Avoid g++ 3.1 warnings.
+ * src/base/cl_offsetof.h (offsetof): Redefine each time.
+ * src/base/digitseq/cl_DS.h: Include "cl_offsetof.h" after <gmp.h>.
+
Avoid g++ 3.1 warnings.
* src/base/hash/cl_hash.h (struct cl_heap_hashtable): Use typename
where needed.
// offsetof() and friends
-#ifndef _CL_OFFSETOF_H
-#define _CL_OFFSETOF_H
+// <stddef.h> in GCC 3.0/3.1 has the obscure property of redefining
+// offsetof every time it is included, not just the first time.
+// Therefore we do the same thing here, and make sure that this file
+// gets included after each include of <stddef.h>.
#undef offsetof
#if defined(__GNUG__)
#else
#define offsetof(type,ident) ((long)&(((type*)0)->ident))
#endif
+
+#ifndef _CL_OFFSETOF_H
+#define _CL_OFFSETOF_H
+
#define offsetofa(type,ident) offsetof(type,ident[0])
#endif /* _CL_OFFSETOF_H */
} // namespace cln
#include <gmp.h>
+// Argh, gmp.h includes <stddef.h> which erases the definition of offsetof
+// that we have provided in cl_offsetof.h. Restore it.
+#include "cl_offsetof.h"
namespace cln {