[tlbuild] lcdf-typetools-2.85 doesn't compile with gcc-3.4.2 on old FreeBSD-5

Peter Breitenlohner peb at mppmu.mpg.de
Mon Feb 7 18:56:07 CET 2011


On Mon, 7 Feb 2011, Peter Breitenlohner wrote:

> I have no problem with g++-3.4.6, but I see that my (linux) stddef.h
> from 3.3.3 has
>    #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
> whereas 3.4.6 has
>    #ifndef __cplusplus
>    #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
>    #else
>    #define offsetof(TYPE, MEMBER)                                  \
>      (__offsetof__ (reinterpret_cast <size_t>                      \
>                     (&reinterpret_cast <const volatile char &>     \
>                      (static_cast<TYPE *> (0)->MEMBER))))
>    #endif

Hi Nikola, Eddie, Jonathan,

Looking through the gcc-3.4.6 ChangeLog I found these entries:

 	2004-09-06  Release Manager

 		* GCC 3.4.2 released.

 	2004-08-11  Mark Mitchell  <mark at codesourcery.com>

 		PR c++/16618
 		* ginclude/stddef.h (offsetof): Refine C++ definition.

 	2004-07-01  Release Manager

 		* GCC 3.4.1 released.

This suggests that there was a bug fixed between 3.4.1 and 3.4.2, although
it is somewhat strange that the bug is still present in gcc-3.4.2 from
FreeBSD-5.

Since the alternatives with sizeof(memo_t) have their own portability
problems, it might be best to stick to the original code with offsetof (that
should either yield an error or produce the correct value).

Nikola,

you can always apply a local patch to compile lcdf-typetools for FreeBSD-5
using gcc-3.4.2.

Regards
Peter Breitenlohner <peb at mppmu.mpg.de>


More information about the tlbuild mailing list