Skip to content

Commit

Permalink
Fix clang libcxx warnings <2.0.x> (#1304)
Browse files Browse the repository at this point in the history
* Refs 8887. Fixing TypeObjectFactory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Fixing  SharedMemUUID.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Update sqlite to version 3.32.3.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Update boost files to version 1.73.0.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Fixing  sp_counted_base_clang.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Include what you use.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 8887. Mark GetVersionEx methods as deprecated.
  • Loading branch information
MiguelCompany committed Jul 22, 2020
1 parent d5718a1 commit 8e69642
Show file tree
Hide file tree
Showing 301 changed files with 70,795 additions and 43,402 deletions.
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Expand Up @@ -360,6 +360,7 @@ elseif(NOT EPROSIMA_INSTALLER)
${PROJECT_NAME_UPPER}_SOURCE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
SQLITE_WIN32_GETVERSIONEX=0
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
$<$<AND:$<BOOL:${WIN32}>,$<STREQUAL:"${CMAKE_SYSTEM_NAME}","WindowsStore">>:_WIN32_WINNT=0x0603>
Expand Down
278 changes: 167 additions & 111 deletions src/cpp/dynamic-types/TypeObjectFactory.cpp

Large diffs are not rendered by default.

96,091 changes: 59,132 additions & 36,959 deletions src/cpp/rtps/persistence/sqlite3.c

Large diffs are not rendered by default.

2,165 changes: 1,753 additions & 412 deletions src/cpp/rtps/persistence/sqlite3.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/cpp/rtps/transport/shared_mem/SharedMemTransport.h
Expand Up @@ -21,6 +21,8 @@
#include <rtps/transport/shared_mem/SharedMemManager.hpp>
#include <rtps/transport/shared_mem/SharedMemLog.hpp>

#include <map>

namespace eprosima {
namespace fastdds {
namespace rtps {
Expand Down
27 changes: 11 additions & 16 deletions src/cpp/rtps/transport/shared_mem/SharedMemUUID.hpp
Expand Up @@ -17,7 +17,7 @@

#ifdef _MSC_VER
#include <Windows.h>
#endif
#endif // ifdef _MSC_VER

#include <stdint.h>
#include <random>
Expand Down Expand Up @@ -78,12 +78,12 @@ class UUIDGen
std::mt19937 gen;

// The seed is derived from the ProcessID and the steady clock
std::array<uint32_t,4> seq;
std::array<uint32_t, 4> seq;
uint64_t pid = this_process_pid();
seq[0] = static_cast<uint32_t>(pid);
seq[1] = static_cast<uint32_t>(pid>>32);
seq[1] = static_cast<uint32_t>(pid >> 32);
seq[2] = static_cast<uint32_t>(now);
seq[3] = static_cast<uint32_t>(now>>32);
seq[3] = static_cast<uint32_t>(now >> 32);

std::seed_seq seed_seq(seq.begin(), seq.end());
gen.seed(seed_seq);
Expand All @@ -107,8 +107,9 @@ class UUIDGen
return GetCurrentProcessId();
#else // POSIX
return static_cast<uint64_t>(getpid());
#endif
#endif // ifdef _MSC_VER
}

};

template <size_t SIZE>
Expand All @@ -126,15 +127,7 @@ class UUID
UUID(
const null_t&)
{
memset(uuid_, 0, SIZE);
}

UUID& operator =(
const UUID& other)
{
memcpy(uuid_, other.uuid_, sizeof(uuid_));

return *this;
memset(uuid_, 0, sizeof(uuid_));
}

static void generate(
Expand All @@ -155,6 +148,7 @@ class UUID

size_t hash() const
{
static_assert(sizeof(uuid_) >= sizeof(size_t), "UUID size should accomodate a size_t");
return *reinterpret_cast<const size_t*>(uuid_);
}

Expand All @@ -163,7 +157,7 @@ class UUID
// TODO(Adolfo): This function should be allocation free
std::stringstream ss;

for (size_t i=0; i < sizeof(uuid_); i++ )
for (size_t i = 0; i < sizeof(uuid_); i++ )
{
std::stringstream hex_ss;
hex_ss << std::hex << static_cast<unsigned int>(uuid_[i]);
Expand Down Expand Up @@ -194,11 +188,12 @@ namespace std {
template <>
struct hash<eprosima::fastdds::rtps::UUID<8> >
{
std::size_t operator()(
std::size_t operator ()(
const eprosima::fastdds::rtps::UUID<8>& k) const
{
return k.hash();
}

};

} // namespace std
Expand Down
93 changes: 93 additions & 0 deletions thirdparty/boost/include/boost/assert/source_location.hpp
@@ -0,0 +1,93 @@
#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED
#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED

// http://www.boost.org/libs/assert
//
// Copyright 2019 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt

#include <boost/current_function.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <iosfwd>

namespace boost
{

struct source_location
{
private:

char const * file_;
char const * function_;
boost::uint_least32_t line_;
boost::uint_least32_t column_;

public:

BOOST_CONSTEXPR source_location() BOOST_NOEXCEPT: file_( "(unknown)" ), function_( "(unknown)" ), line_( 0 ), column_( 0 )
{
}

BOOST_CONSTEXPR source_location( char const * file, boost::uint_least32_t ln, char const * function, boost::uint_least32_t col = 0 ) BOOST_NOEXCEPT: file_( file ), function_( function ), line_( ln ), column_( col )
{
}

BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT
{
return file_;
}

BOOST_CONSTEXPR char const * function_name() const BOOST_NOEXCEPT
{
return function_;
}

BOOST_CONSTEXPR boost::uint_least32_t line() const BOOST_NOEXCEPT
{
return line_;
}

BOOST_CONSTEXPR boost::uint_least32_t column() const BOOST_NOEXCEPT
{
return column_;
}
};

template<class E, class T> std::basic_ostream<E, T> & operator<<( std::basic_ostream<E, T> & os, source_location const & loc )
{
os.width( 0 );

if( loc.line() == 0 )
{
os << "(unknown source location)";
}
else
{
os << loc.file_name() << ':' << loc.line();

if( loc.column() )
{
os << ':' << loc.column();
}

os << ": in function '" << loc.function_name() << '\'';
}

return os;
}

} // namespace boost

#if defined( BOOST_DISABLE_CURRENT_LOCATION )

# define BOOST_CURRENT_LOCATION ::boost::source_location()

#else

# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)

#endif

#endif // #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED
27 changes: 23 additions & 4 deletions thirdparty/boost/include/boost/config/auto_link.hpp
Expand Up @@ -28,6 +28,9 @@ BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
BOOST_AUTO_LINK_TAGGED: Specifies that we link to libraries built with the --layout=tagged option.
This is essentially the same as the default name-mangled version, but without
the compiler name and version, or the Boost version. Just the build options.
BOOST_AUTO_LINK_SYSTEM: Specifies that we link to libraries built with the --layout=system option.
This is essentially the same as the non-name-mangled version, but with
the prefix to differentiate static and dll builds
These macros will be undef'ed at the end of the header, further this header
has no include guards - so be sure to include it only once from your library!
Expand Down Expand Up @@ -96,7 +99,8 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
#if defined(BOOST_MSVC) \
|| defined(__BORLANDC__) \
|| (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \
|| (defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4))

#ifndef BOOST_VERSION_HPP
# include <boost/version.hpp>
Expand Down Expand Up @@ -170,11 +174,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// vc14:
# define BOOST_LIB_TOOLSET "vc140"

# elif defined(BOOST_MSVC)
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1920)

// vc14.1:
# define BOOST_LIB_TOOLSET "vc141"

# elif defined(BOOST_MSVC)

// vc14.2:
# define BOOST_LIB_TOOLSET "vc142"

# elif defined(__BORLANDC__)

// CBuilder 6:
Expand All @@ -195,6 +204,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// Metrowerks CodeWarrior 9.x
# define BOOST_LIB_TOOLSET "cw9"

# elif defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4)

// Clang on Windows
# define BOOST_LIB_TOOLSET "clangw" BOOST_STRINGIZE(__clang_major__)

# endif
#endif // BOOST_LIB_TOOLSET

Expand Down Expand Up @@ -402,9 +416,14 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
&& defined(BOOST_LIB_VERSION)

#ifdef BOOST_AUTO_LINK_TAGGED
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_ARCH_AND_MODEL_OPT ".lib")
# ifdef BOOST_LIB_DIAGNOSTIC
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_ARCH_AND_MODEL_OPT ".lib")
# endif
#elif defined(BOOST_AUTO_LINK_SYSTEM)
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
# ifdef BOOST_LIB_DIAGNOSTIC
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
# endif
#elif defined(BOOST_AUTO_LINK_NOMANGLE)
# pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
Expand Down
18 changes: 17 additions & 1 deletion thirdparty/boost/include/boost/config/compiler/clang.hpp
Expand Up @@ -57,6 +57,14 @@
# define BOOST_HAS_STDINT_H
#endif

#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
#if (__clang_major__ >= 4) && defined(__has_include)
#if __has_include(<quadmath.h>)
# define BOOST_HAS_FLOAT128
#endif
#endif
#endif


#define BOOST_HAS_NRVO

Expand Down Expand Up @@ -104,9 +112,9 @@
# define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__))
#else
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
# define BOOST_SYMBOL_IMPORT
#endif
#define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))

//
// The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
Expand Down Expand Up @@ -244,6 +252,10 @@
# define BOOST_NO_CXX11_FINAL
#endif

#if !__has_feature(cxx_unrestricted_unions)
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif

#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
Expand Down Expand Up @@ -294,6 +306,10 @@
# define BOOST_NO_CXX17_STRUCTURED_BINDINGS
#endif

#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
# define BOOST_NO_CXX17_IF_CONSTEXPR
#endif

// Clang 3.9+ in c++1z
#if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L
# define BOOST_NO_CXX17_INLINE_VARIABLES
Expand Down
25 changes: 18 additions & 7 deletions thirdparty/boost/include/boost/config/compiler/gcc.hpp
Expand Up @@ -232,7 +232,6 @@
// C++0x features in 4.6.n and later
//
#if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11)
#define BOOST_NO_CXX11_CONSTEXPR
#define BOOST_NO_CXX11_DEFAULTED_MOVES
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_NULLPTR
Expand All @@ -243,6 +242,9 @@
// C++0x features in 4.7.n and later
//
#if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11)
// Note that while constexpr is partly supported in gcc-4.6 it's a
// pre-std version with several bugs:
# define BOOST_NO_CXX11_CONSTEXPR
# define BOOST_NO_CXX11_FINAL
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
Expand All @@ -265,6 +267,12 @@
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif

// C++0x features in 5.1 and later
//
#if (BOOST_GCC_VERSION < 50100) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif

// C++14 features in 4.9.0 and later
//
#if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300)
Expand Down Expand Up @@ -299,13 +307,16 @@
#if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603)
# define BOOST_NO_CXX17_FOLD_EXPRESSIONS
#endif
#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
# define BOOST_NO_CXX17_IF_CONSTEXPR
#endif

#if __GNUC__ >= 7
# define BOOST_FALLTHROUGH __attribute__((fallthrough))
#endif

#ifdef __MINGW32__
// Currently (June 2017) thread_local is broken on mingw for all current compiler releases, see
#if defined(__MINGW32__) && !defined(__MINGW64__)
// Currently (March 2019) thread_local is broken on mingw for all current 32bit compiler releases, see
// https://sourceforge.net/p/mingw-w64/bugs/527/
// Not setting this causes program termination on thread exit.
#define BOOST_NO_CXX11_THREAD_LOCAL
Expand All @@ -322,7 +333,7 @@

//
// __builtin_unreachable:
#if BOOST_GCC_VERSION >= 40800
#if BOOST_GCC_VERSION >= 40500
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
#endif

Expand All @@ -343,14 +354,14 @@
# error "Compiler not configured - please reconfigure"
#endif
//
// last known and checked version is 7.1:
#if (BOOST_GCC_VERSION > 70100)
// last known and checked version is 8.1:
#if (BOOST_GCC_VERSION > 80100)
# if defined(BOOST_ASSERT_CONFIG)
# error "Boost.Config is older than your compiler - please check for an updated Boost release."
# else
// we don't emit warnings here anymore since there are no defect macros defined for
// gcc post 3.4, so any failures are gcc regressions...
//# warning "Unknown compiler version - please run the configure tests and report the results"
//# warning "boost: Unknown compiler version - please run the configure tests and report the results"
# endif
#endif

0 comments on commit 8e69642

Please sign in to comment.