mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 20:03:33 +08:00
Work-around for false -Wtype-limits from GCC
This commit is contained in:
@@ -103,7 +103,7 @@ if (DEBUG_BUILD)
|
||||
if (COMPILER_IS_GCC_COMPATIBLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic -Wfloat-equal -Wconversion")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion -Wcast-align -Wmissing-declarations -Wlogical-op")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=array-bounds")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtype-limits -Wno-error=array-bounds")
|
||||
set(cpp03_flags "-std=c++03 -Wno-variadic-macros -Wno-long-long")
|
||||
set(optim_flags "-O3 -DNDEBUG -g0")
|
||||
else ()
|
||||
|
||||
@@ -480,6 +480,10 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
#endif
|
||||
int decodeImpl(ScalarCodec& codec, const TailArrayOptimizationMode tao_mode, TrueType) /// Dynamic
|
||||
{
|
||||
StaticAssert<IsDynamic>::check();
|
||||
@@ -513,7 +517,7 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
|
||||
{
|
||||
return res_sz;
|
||||
}
|
||||
if (static_cast<unsigned>(sz) > MaxSize_)
|
||||
if (static_cast<unsigned>(sz) > MaxSize_) // False 'type-limits' warning occurs here
|
||||
{
|
||||
return -ErrInvalidMarshalData;
|
||||
}
|
||||
@@ -527,6 +531,9 @@ class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
|
||||
UAVCAN_ASSERT(0); // Unreachable
|
||||
return -ErrLogic;
|
||||
}
|
||||
#if __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
template <typename InputIter>
|
||||
void packSquareMatrixImpl(const InputIter src_row_major)
|
||||
|
||||
Reference in New Issue
Block a user