]> www.ginac.de Git - cln.git/commitdiff
Avoid g++-3.1 offsetof warnings.
authorBruno Haible <bruno@clisp.org>
Mon, 6 May 2002 10:28:43 +0000 (10:28 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 6 May 2002 10:28:43 +0000 (10:28 +0000)
ChangeLog
src/base/cl_offsetof.h
src/base/digitseq/cl_DS.h

index d1dbcd1134455043f959f5743b10e48d92db76d8..952833838fc8bd1f30b25e78a1dc8bbe678ca736 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 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.
index 319233448d0ff62439f4831b3d57682ed1cb677f..89ddaf272e7657e35694ddc740e787f332b01bfd 100644 (file)
@@ -1,7 +1,9 @@
 // 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__)
@@ -9,6 +11,10 @@
 #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 */
index ba7fb31d29e7e28b16e6263432145e57b2ed0f85..246ccd8301b6b37607a16eb05d0ddd9977b4234f 100644 (file)
@@ -354,6 +354,9 @@ extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC
 }  // 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 {