Boost logo

Boost :

Subject: Re: [boost] [1.61.0] building with Clang and c++11
From: Vladimir Prus (vladimir.prus_at_[hidden])
Date: 2016-07-01 04:55:24


for context, I don't think Boost C++ Libraries can be expected to build
without warnings on any compiler these days. There are just too many
versions of compilers producing warnings in too many ingenious ways.

On 30-Jun-16 11:32 PM, Richard Hadsell wrote:
> I have downloaded 1.61.0 and want to build it with Clang. This is in my
> user-config:
> using clang : 3.5.0 :
> /netDISKS/master/netmt/LINUX_C65/app/clang/3.5.0/bin/clang++ :
> <compileflags>"-fPIC -gcc-toolchain
> /netDISKS/master/netmt/LINUX_C65/app/gcc/4.8.3 -Wno-overloaded-virtual
> -Wno-unused-function -Wno-unused-variable -Wno-c99-extensions
> -Wno-variadic-macros" <linkflags>"-fPIC -gcc-toolchain
> /netDISKS/master/netmt/LINUX_C65/app/gcc/4.8.3" ;
> When I build, I see warnings like these:
> ./boost/mpl/print.hpp:50:19: warning: in-class initialization of
> non-static data member is a C++11 extension [-Wc++11-extensions]
> const int m_x = 1 / (sizeof(T) - sizeof(T));
> ^
> ./boost/timer/timer.hpp:44:43: warning: 'long long' is a C++11 extension
> [-Wc++11-long-long]
> void clear() { wall = user = system = 0LL; }
> ^
> ./boost/regex/v4/instances.hpp:124:34: warning: unknown warning group
> '-Wkeyword-macro', ignored [-Wunknown-pragmas]
> #pragma clang diagnostic ignored "-Wkeyword-macro"

The warnings above mention the command-line options that will silence
the warnings. E.g. if you pass -Wno-keyword-macro, the last warning
should go away. Likewise for other warnings. You might consider
reporting these warnings to libraries developers.

> When I add '-std=c++11' to the <compileflags> and <linkflags>, I get
> errors and warnings like these:
> clang-linux.compile.c.without-pth
> bin.v2/libs/container/build/clang-linux-3.5.0/release/instruction-set-core2/link-static/threading-multi/alloc_lib.o
> error: invalid argument '-std=c++11' not allowed with 'C/ObjC'

Seems like clang is unnecessary pedantic here. Though, I don't know why
container includes .c files - might be worth raising an issue too.

So, the bottom line is that you either have to live with the warnings,
or disable them with '-Wno-*' options.


Boost list run by bdawes at, gregod at, cpdaniel at, john at