error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wc++-compat]

Marcin Cieslak saper at saper.info
Thu Sep 4 13:01:40 UTC 2014


In my clang 3.3 FreeBSD -CURRENT (r259613 as of Dec 2013)
I used to have CFLAGS+=-Wc++-compat in my /etc/make.conf 
probably from some older guide to enable CTF and DTrace.

During an upgrade to today's r271089, with this flag (and -Werror)
the "make toolchain" command fails on the empty structures,
for example struct pthread{} in lib/libc/gen/_pthread_stubs.c

Not sure this is a real problem, rather a heads-up
to those who did not clean up their make.conf regularly.

I don't think I've had this problem with clang 3.3

Old (r271089) clang is:

$ clang --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd11.0
Thread model: posix

New (being built):

$ /usr/obj/usr/src/tmp/usr/bin/clang --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd11.0
Thread model: posix


//Marcin


More information about the freebsd-toolchain mailing list