Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Oct 2015 04:36:13 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        David Chisnall <theraven@FreeBSD.org>, Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: powerpc64-xtoolchain-gcc/powerpc64-gcc gets libcxxrt/guard.cc:104:15: error: expected constructor, destructor, . . . for lib32 (clang 3.6.1 context)
Message-ID:  <15CF1760-66B9-477B-B382-7F0C41D7C699@dsl-only.net>
In-Reply-To: <A7A5E829-EB88-4D0B-919F-5403CB966EE3@FreeBSD.org>
References:  <C5A031FF-4CDE-4B37-9CB1-A9F5224EEC52@dsl-only.net> <A7A5E829-EB88-4D0B-919F-5403CB966EE3@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2015-Oct-12, at 01:21 AM, David Chisnall <theraven at FreeBSD.org> =
wrote:

> On 12 Oct 2015, at 03:17, Mark Millard <markmi at dsl-only.net> wrote:
>>=20
>> /usr/src/lib/libcxxrt/../../contrib/libcxxrt/guard.cc:104:15: error: =
expected constructor, destructor, or type conversion before '(' token
>> _Static_assert(sizeof(guard_t) =3D=3D sizeof(uint64_t), "");
>=20
> I think that this is the error that you get with old gcc when a static =
assert fails.  What is the type of guard_t on PPC64?  It may simply be =
that gcc isn=E2=80=99t providing the correct #defines to let the file =
know that it=E2=80=99s a 64-bit target.
>=20
> David


Turns out that _Static_assert is a C11 keyword (not before), and not a =
C++ keyword at all, not c++11 nor c++14 nor c++17 that I=E2=80=99ve =
found. So far I=E2=80=99ve not found any FreeBSD specific definition =
that effectively adds it to c++ for FreeBSD.

lines 100 through 104 of guard.cc (from -r276417, 2014-Dec-30 by bapt) =
are:

typedef struct {
        uint32_t init_half;
        uint32_t lock_half;
} guard_t;
_Static_assert(sizeof(guard_t) =3D=3D sizeof(uint64_t), "");

which would seem to be unlikely to have sizeof(guard_t) =3D=3D =
sizeof(uint64_t) be false unless there was unusual padding.

This is for a not __LITTLE_ENDIAN__, not __arm__, not _LP64 context =
(following the #if. . . structure those lines are contained in). powerpc =
code (lib32 code under powerpc64) fits that.

The compiler in use was a c++ one (well, g++, 5.2 vintage) in use for =
c++ source code (.cc) compiled with -m32:

> /usr/local/bin/powerpc64-portbld-freebsd11.0-g++ -m32 -mcpu=3Dpowerpc =
-DCOMPAT_32BIT  -isystem =
/usr/obj/powerpc.powerpc64/usr/src/lib32/usr/include/  =
-L/usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32  =
-B/usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 =
--sysroot=3D/usr/obj/powerpc.powerpc64/usr/src/tmp -pg  -O2 -pipe =
-I/usr/src/lib/libcxxrt/../../contrib/libcxxrt -fstack-protector   -c =
/usr/src/lib/libcxxrt/../../contrib/libcxxrt/guard.cc -o guard.po
> /usr/src/lib/libcxxrt/../../contrib/libcxxrt/guard.cc:104:15: error: =
expected constructor, destructor, or type conversion before '(' token
> _Static_assert(sizeof(guard_t) =3D=3D sizeof(uint64_t), "");
>               ^
> *** [guard.po] Error code 1


I will note that no 4.2.1 or other old gcc for compiling to =
powerpc/powerpc64 from amd64 was present.

As near as I can tell, for FreeBSD as it is, _Static_assert should not =
be used for a c++ context such as guard.cc. But 32 bit powerpc contexts =
may be the primary examples with _Static_assert in use that way.

=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15CF1760-66B9-477B-B382-7F0C41D7C699>