fix gcc build (gcc 7) (#690)

simple solution, disable the specific warning
This commit is contained in:
menete 2018-06-08 20:41:06 +02:00 committed by Neil MacIntosh
parent cb2d1af89a
commit ffdaf0fb21
3 changed files with 37 additions and 10 deletions

View File

@ -160,17 +160,16 @@ matrix:
- env: COMPILER=g++-6 BUILD_TYPE=Release - env: COMPILER=g++-6 BUILD_TYPE=Release
addons: *gcc6 addons: *gcc6
# Currently fails due to #525 # GCC 7
## GCC 7 - env: COMPILER=g++-7 BUILD_TYPE=Debug
#- env: COMPILER=g++-7 BUILD_TYPE=Debug addons: &gcc7
# addons: &gcc7 apt:
# apt: packages: g++-7
# packages: g++-7 sources:
# sources: - ubuntu-toolchain-r-test
# - ubuntu-toolchain-r-test
#- env: COMPILER=g++-7 BUILD_TYPE=Release - env: COMPILER=g++-7 BUILD_TYPE=Release
# addons: *gcc7 addons: *gcc7
install: install:

View File

@ -51,6 +51,16 @@
#endif // _MSC_VER < 1910 #endif // _MSC_VER < 1910
#endif // _MSC_VER #endif // _MSC_VER
// GCC 7 does not like the signed unsigned missmatch (size_t ptrdiff_t)
// While there is a conversion from signed to unsigned, it happens at
// compiletime, so the compiler wouldn't have to warn indiscriminently, but
// could check if the source value actually doesn't fit into the target type
// and only warn in those cases.
#if __GNUC__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#ifdef GSL_THROW_ON_CONTRACT_VIOLATION #ifdef GSL_THROW_ON_CONTRACT_VIOLATION
#define GSL_NOEXCEPT /*noexcept*/ #define GSL_NOEXCEPT /*noexcept*/
#else #else
@ -2225,4 +2235,8 @@ general_span_iterator<Span> operator+(typename general_span_iterator<Span>::diff
#endif // _MSC_VER #endif // _MSC_VER
#if __GNUC__ > 6
#pragma GCC diagnostic pop
#endif // __GNUC__ > 6
#endif // GSL_MULTI_SPAN_H #endif // GSL_MULTI_SPAN_H

View File

@ -58,6 +58,16 @@
#endif // _MSC_VER #endif // _MSC_VER
// GCC 7 does not like the signed unsigned missmatch (size_t ptrdiff_t)
// While there is a conversion from signed to unsigned, it happens at
// compiletime, so the compiler wouldn't have to warn indiscriminently, but
// could check if the source value actually doesn't fit into the target type
// and only warn in those cases.
#if __GNUC__ > 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
namespace gsl namespace gsl
{ {
@ -749,4 +759,8 @@ constexpr ElementType& at(span<ElementType, Extent> s, index i)
#pragma warning(pop) #pragma warning(pop)
#endif // _MSC_VER #endif // _MSC_VER
#if __GNUC__ > 6
#pragma GCC diagnostic pop
#endif // __GNUC__ > 6
#endif // GSL_SPAN_H #endif // GSL_SPAN_H