Fix build in gcc7 (#641)

* Fix build in gcc7

* try reduce warn area

* better fix
This commit is contained in:
proller 2017-03-31 08:09:11 +03:00 committed by alexey-milovidov
parent 633b829ca5
commit 29d4471b9d
2 changed files with 25 additions and 1 deletions

View File

@ -438,7 +438,7 @@ bool TimeZoneInfo::Load(const std::string& name, FILE* fp) {
// Determine the before-first-transition type. // Determine the before-first-transition type.
default_transition_type_ = 0; default_transition_type_ = 0;
if (seen_type_0 && hdr.timecnt != 0) { if (seen_type_0 && hdr.timecnt != 0) {
std::uint_fast8_t index = 0; std::int_fast8_t index = 0;
if (transition_types_[0].is_dst) { if (transition_types_[0].is_dst) {
index = transitions_[0].type_index; index = transitions_[0].type_index;
while (index != 0 && transition_types_[index].is_dst) while (index != 0 && transition_types_[index].is_dst)

View File

@ -8,9 +8,16 @@
namespace DB namespace DB
{ {
/// Для агрегации по SipHash или конкатенации нескольких полей. /// Для агрегации по SipHash или конкатенации нескольких полей.
struct UInt128 struct UInt128
{ {
/// Suppress gcc7 warnings: 'prev_key.DB::UInt128::first' may be used uninitialized in this function
#if !__clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
UInt64 first; UInt64 first;
UInt64 second; UInt64 second;
@ -20,6 +27,10 @@ struct UInt128
bool operator== (const UInt64 rhs) const { return first == rhs && second == 0; } bool operator== (const UInt64 rhs) const { return first == rhs && second == 0; }
bool operator!= (const UInt64 rhs) const { return first != rhs || second != 0; } bool operator!= (const UInt64 rhs) const { return first != rhs || second != 0; }
#if !__clang__
#pragma GCC diagnostic pop
#endif
UInt128 & operator= (const UInt64 rhs) { first = rhs; second = 0; return *this; } UInt128 & operator= (const UInt64 rhs) { first = rhs; second = 0; return *this; }
}; };
@ -64,6 +75,13 @@ inline void writeBinary(const UInt128 & x, WriteBuffer & buf) { writePODBinary(x
*/ */
struct UInt256 struct UInt256
{ {
/// Suppress gcc7 warnings: 'prev_key.DB::UInt256::a' may be used uninitialized in this function
#if !__clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
UInt64 a; UInt64 a;
UInt64 b; UInt64 b;
UInt64 c; UInt64 c;
@ -88,6 +106,10 @@ struct UInt256
bool operator== (const UInt64 rhs) const { return a == rhs && b == 0 && c == 0 && d == 0; } bool operator== (const UInt64 rhs) const { return a == rhs && b == 0 && c == 0 && d == 0; }
bool operator!= (const UInt64 rhs) const { return !operator==(rhs); } bool operator!= (const UInt64 rhs) const { return !operator==(rhs); }
#if !__clang__
#pragma GCC diagnostic pop
#endif
UInt256 & operator= (const UInt64 rhs) { a = rhs; b = 0; c = 0; d = 0; return *this; } UInt256 & operator= (const UInt64 rhs) { a = rhs; b = 0; c = 0; d = 0; return *this; }
}; };
@ -130,6 +152,8 @@ struct UInt256HashCRC32
#endif #endif
inline void readBinary(UInt256 & x, ReadBuffer & buf) { readPODBinary(x, buf); } inline void readBinary(UInt256 & x, ReadBuffer & buf) { readPODBinary(x, buf); }
inline void writeBinary(const UInt256 & x, WriteBuffer & buf) { writePODBinary(x, buf); } inline void writeBinary(const UInt256 & x, WriteBuffer & buf) { writePODBinary(x, buf); }