Browse Source

Avoid g++-3.1 offsetof warnings.

master
Bruno Haible 23 years ago
parent
commit
1b9acd9ada
  1. 4
      ChangeLog
  2. 10
      src/base/cl_offsetof.h
  3. 3
      src/base/digitseq/cl_DS.h

4
ChangeLog

@ -1,5 +1,9 @@
2002-05-05 Bruno Haible <bruno@clisp.org> 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. Avoid g++ 3.1 warnings.
* src/base/hash/cl_hash.h (struct cl_heap_hashtable): Use typename * src/base/hash/cl_hash.h (struct cl_heap_hashtable): Use typename
where needed. where needed.

10
src/base/cl_offsetof.h

@ -1,7 +1,9 @@
// offsetof() and friends // 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 #undef offsetof
#if defined(__GNUG__) #if defined(__GNUG__)
@ -9,6 +11,10 @@
#else #else
#define offsetof(type,ident) ((long)&(((type*)0)->ident)) #define offsetof(type,ident) ((long)&(((type*)0)->ident))
#endif #endif
#ifndef _CL_OFFSETOF_H
#define _CL_OFFSETOF_H
#define offsetofa(type,ident) offsetof(type,ident[0]) #define offsetofa(type,ident) offsetof(type,ident[0])
#endif /* _CL_OFFSETOF_H */ #endif /* _CL_OFFSETOF_H */

3
src/base/digitseq/cl_DS.h

@ -354,6 +354,9 @@ extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC
} // namespace cln } // namespace cln
#include <gmp.h> #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 { namespace cln {

Loading…
Cancel
Save