powerpc64-xtoolchain-gcc/powerpc64-gcc gets libcxxrt/guard.cc:104:15: error: expected constructor, destructor, . . . for lib32 (clang 3.6.1 context)
Mark Millard
markmi at dsl-only.net
Tue Oct 13 11:36:24 UTC 2015
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:
>>
>> /usr/src/lib/libcxxrt/../../contrib/libcxxrt/guard.cc:104:15: error: expected constructor, destructor, or type conversion before '(' token
>> _Static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
>
> 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’t providing the correct #defines to let the file know that it’s a 64-bit target.
>
> 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’ve found. So far I’ve 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) == sizeof(uint64_t), "");
which would seem to be unlikely to have sizeof(guard_t) == 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=powerpc -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=/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) == 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.
===
Mark Millard
markmi at dsl-only.net
More information about the freebsd-ppc
mailing list