Modern C++ API - rtiboost usage and a small logic error

4 posts / 0 new
Last post
Offline
Last seen: 3 years 11 months ago
Joined: 08/25/2015
Posts: 32
Modern C++ API - rtiboost usage and a small logic error

Hi,


once again a question regarding the modern c++ API.

First there seems to be a logic error in include/ndds/hpp/dds/core/detail/macros.hpp:142

#if !(defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 1101)

#define RTI_NO_CXX11_HDR_TYPE_TRAITS

#endif

The line #if !(defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 1101) should be #if (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 1101) - otherwise when  _LIBCPP_VERSION is not defined, the line evaluates to true and RTI_NO_CXX11_HDR_TYPE_TRAITS gets defined which is not what you want I guess.

I found this while I tried to replace all rtiboost references with std equivalents (which btw works fine except the linker erros later on...) because rtiboost generates a lot of warnings when compiled with a c++11 - compiler.

Most of the errors are coming from here

/opt/RTI/include/ndds/hpp/rtiboost/smart_ptr/shared_ptr.hpp: In member function 'rtiboost::shared_ptr& rtiboost::shared_ptr::operator=(std::auto_ptr<_Up>&&)':

/opt/RTI/include/ndds/hpp/rtiboost/smart_ptr/shared_ptr.hpp:540:38: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]

     this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this );

Is there a chance to remove this warnings in the next release?

 

Thx,

Christian

Offline
Last seen: 2 months 1 week ago
Joined: 04/02/2013
Posts: 194

Hi Christian,

The full condition is this:

#if defined(RTIBOOST_NO_CXX11_HDR_TYPE_TRAITS)
#if !(defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 1101)
#define RTI_NO_CXX11_HDR_TYPE_TRAITS
#endif
#endif

What this is doing is actually relaxing what version of libcpp Boost thinks doesn't provide the header <traits>. In general we rely on Boost macros to figure out what C++11 features are available, but we found that in some cases it was too restrictive. This is one of them.

So the logic is as follows:

if boost says no traits header
    if we're using anything other than libcpp above a certain version
         disable traits header

However this might still be too restrictive. What compiler are you using?

Alex

 

Offline
Last seen: 3 years 11 months ago
Joined: 08/25/2015
Posts: 32

Your're correct - the main problem is that rtiboost does not support my compiler correct. I'm using gcc 4.8 / gcc 5.x and rtiboost/config/stdlib/libstdcpp3.hpp only has checks for gcc <= 4.7 and therefore defines RTIBOOST_NO_CXX11_HDR_TYPE_TRAITS which is imo wrong for gcc 4.8 and up.


But still in recent boost headers BOOST_NO_CXX11_HDR_TYPE_TRAITS is active for gcc < 5.1 ... strange

See http://www.boost.org/doc/libs/1_59_0_b1/boost/config/stdlib/libstdcpp3.hpp

Offline
Last seen: 2 months 1 week ago
Joined: 04/02/2013
Posts: 194

The version of boost we include with our API is a bit older, so that's probably the problem. I will file a bug to make sure we investigate this issue for the next release.

Thanks for reporting the problem.