[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 14:14:10 CET 2011

,On Mon, 7 Feb 2011, Nikola Le?i? wrote:

> New lcdf-typetools source fails to compile with gcc-3.4.2 (from the
> base of an old FreeBSD-5). I don't know how complicated it is to
> correct this and if it's worth trying at all because this is an
> "extended" FreeBSD support and affects only a tiny minority of users. I
> mean, --without-lcdf-typetools would be perfectly acceptable here.
> Still, on FreeBSD-5.5/amd64, gcc 3.4.2:
> g++ -Wimplicit -Wreturn-type -Wno-unknown-pragmas -DHAVE_CONFIG_H -I. -I/root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/liblcdf -I.. -I/root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include    -g -O2 -MT error.o -MD -MP -MF .deps/error.Tpo -c -o error.o /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/liblcdf/error.cc
> In file included from /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include/lcdf/error.hh:4,
>                 from /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/liblcdf/error.cc:24:
> /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include/lcdf/string.hh:607: error: a casts to a type other than an integral or enumeration type cannot appear in a constant-expression
> /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include/lcdf/string.hh:607: error: '->' cannot appear in a constant-expression
> /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include/lcdf/string.hh:607: error: `&' cannot appear in a constant-expression
> /root/TeXLive-Devel/trunk/Build/source/texk/lcdf-typetools/include/lcdf/string.hh:608: error: enumerator value for `MEMO_SPACE' not integer constant

Hi Nikola,

it seems your g++ chokes on
     enum {
 	MEMO_SPACE = offsetof(memo_t, real_data)
that was introduced between 2.83 and 2.85 because the offset of real_data

I wonder why this isn't
    offsetof(struct memo_t, real_data)

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)
     #define offsetof(TYPE, MEMBER)                                  \
       (__offsetof__ (reinterpret_cast <size_t>                      \
                      (&reinterpret_cast <const volatile char &>     \
                       (static_cast<TYPE *> (0)->MEMBER))))

Can you please have a look and tell us what is your offsetof (for C++).

And the comments about `-Wno-invalid-offsetof' in gcc.info seem to indicate
that this kind of using offsetoff might be problematic.

Hi Eddie,

any comments?

Peter Breitenlohner <peb at mppmu.mpg.de>

More information about the tlbuild mailing list