diff --git a/src/AggregateFunctions/AggregateFunctionUniqUpTo.h b/src/AggregateFunctions/AggregateFunctionUniqUpTo.h index aecaecbe4bf..48b4c0f2c68 100644 --- a/src/AggregateFunctions/AggregateFunctionUniqUpTo.h +++ b/src/AggregateFunctions/AggregateFunctionUniqUpTo.h @@ -18,11 +18,6 @@ #include -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warray-bounds" -#endif - namespace DB { struct Settings; @@ -291,7 +286,3 @@ public: } - -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif diff --git a/src/AggregateFunctions/ReservoirSamplerDeterministic.h b/src/AggregateFunctions/ReservoirSamplerDeterministic.h index b92ba8cfd7b..a64c02e823b 100644 --- a/src/AggregateFunctions/ReservoirSamplerDeterministic.h +++ b/src/AggregateFunctions/ReservoirSamplerDeterministic.h @@ -165,11 +165,6 @@ public: sorted = false; } -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - void write(DB::WriteBuffer & buf) const { size_t size = samples.size(); @@ -193,10 +188,6 @@ public: } } -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif - private: /// We allocate some memory on the stack to avoid allocations when there are many objects with a small number of elements. using Element = std::pair; diff --git a/src/Columns/ColumnString.h b/src/Columns/ColumnString.h index 895ec16430c..863b080c588 100644 --- a/src/Columns/ColumnString.h +++ b/src/Columns/ColumnString.h @@ -114,12 +114,6 @@ public: return sizeAt(n) == 1; } -/// Suppress gcc 7.3.1 warning: '*((void*)& +8)' may be used uninitialized in this function -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - void insert(const Field & x) override { const String & s = x.get(); @@ -132,10 +126,6 @@ public: offsets.push_back(new_size); } -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif - void insertFrom(const IColumn & src_, size_t n) override { const ColumnString & src = assert_cast(src_); diff --git a/src/Common/Allocator.h b/src/Common/Allocator.h index 06ccbed4064..c348eaea006 100644 --- a/src/Common/Allocator.h +++ b/src/Common/Allocator.h @@ -281,14 +281,6 @@ private: #endif }; -/** When using AllocatorWithStackMemory, located on the stack, - * GCC 4.9 mistakenly assumes that we can call `free` from a pointer to the stack. - * In fact, the combination of conditions inside AllocatorWithStackMemory does not allow this. - */ -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfree-nonheap-object" -#endif /** Allocator with optimization to place small memory ranges in automatic memory. */ @@ -366,7 +358,3 @@ extern template class Allocator; extern template class Allocator; extern template class Allocator; extern template class Allocator; - -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif diff --git a/src/Common/DateLUTImpl.h b/src/Common/DateLUTImpl.h index f5504749684..564d09aff6e 100644 --- a/src/Common/DateLUTImpl.h +++ b/src/Common/DateLUTImpl.h @@ -29,13 +29,6 @@ #define DATE_LUT_ADD ((1970 - DATE_LUT_MIN_YEAR) * 366L * 86400) -#if defined(__PPC__) -#if !defined(__clang__) -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif -#endif - - /// Flags for toYearWeek() function. enum class WeekModeFlag : UInt8 { @@ -1445,9 +1438,3 @@ public: return s; } }; - -#if defined(__PPC__) -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/src/Common/PODArray.h b/src/Common/PODArray.h index d3232d833ee..514c2c635cb 100644 --- a/src/Common/PODArray.h +++ b/src/Common/PODArray.h @@ -225,9 +225,7 @@ public: void clear() { c_end = c_start; } template -#if defined(__clang__) ALWAYS_INLINE /// Better performance in clang build, worse performance in gcc build. -#endif void reserve(size_t n, TAllocatorParams &&... allocator_params) { if (n > capacity()) diff --git a/src/Common/examples/compact_array.cpp b/src/Common/examples/compact_array.cpp index af6257e1963..58c4ea3be1e 100644 --- a/src/Common/examples/compact_array.cpp +++ b/src/Common/examples/compact_array.cpp @@ -1,9 +1,3 @@ -/// Bug in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warray-bounds" -#endif - #include #include #include @@ -262,7 +256,3 @@ int main() runTests(); return 0; } - -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif diff --git a/src/Common/examples/parallel_aggregation.cpp b/src/Common/examples/parallel_aggregation.cpp index 045a385671b..f54c4cee12c 100644 --- a/src/Common/examples/parallel_aggregation.cpp +++ b/src/Common/examples/parallel_aggregation.cpp @@ -69,11 +69,6 @@ static void aggregate1(Map & map, Source::const_iterator begin, Source::const_it ++map[*it]; } -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - static void aggregate12(Map & map, Source::const_iterator begin, Source::const_iterator end) { Map::LookupResult found = nullptr; @@ -122,10 +117,6 @@ static void aggregate22(MapTwoLevel & map, Source::const_iterator begin, Source: } } -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void merge2(MapTwoLevel * maps, size_t num_threads, size_t bucket) { for (size_t i = 1; i < num_threads; ++i) diff --git a/src/Common/examples/parallel_aggregation2.cpp b/src/Common/examples/parallel_aggregation2.cpp index 496331e203d..6c20f46ab0e 100644 --- a/src/Common/examples/parallel_aggregation2.cpp +++ b/src/Common/examples/parallel_aggregation2.cpp @@ -62,11 +62,6 @@ struct AggregateIndependent } }; -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - template struct AggregateIndependentWithSequentialKeysOptimization { @@ -115,11 +110,6 @@ struct AggregateIndependentWithSequentialKeysOptimization } }; -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif - - template struct MergeSequential { @@ -265,20 +255,11 @@ struct Creator void operator()(Value &) const {} }; -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - struct Updater { void operator()(Value & x) const { ++x; } }; -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif - struct Merger { void operator()(Value & dst, const Value & src) const { dst += src; } diff --git a/src/Core/Field.h b/src/Core/Field.h index a0945b8315a..47241aa1f3e 100644 --- a/src/Core/Field.h +++ b/src/Core/Field.h @@ -105,10 +105,6 @@ template bool decimalEqual(T x, T y, UInt32 x_scale, UInt32 y_scale template bool decimalLess(T x, T y, UInt32 x_scale, UInt32 y_scale); template bool decimalLessOrEqual(T x, T y, UInt32 x_scale, UInt32 y_scale); -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif template class DecimalField { @@ -168,9 +164,6 @@ private: T dec; UInt32 scale; }; -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif template constexpr bool is_decimal_field = false; template <> constexpr inline bool is_decimal_field> = true; @@ -594,11 +587,6 @@ public: switch (field.which) { case Types::Null: return f(field.template get()); -// gcc 8.2.1 -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif case Types::UInt64: return f(field.template get()); case Types::UInt128: return f(field.template get()); case Types::UInt256: return f(field.template get()); @@ -622,9 +610,6 @@ public: case Types::Decimal128: return f(field.template get>()); case Types::Decimal256: return f(field.template get>()); case Types::AggregateFunctionState: return f(field.template get()); -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif } __builtin_unreachable(); diff --git a/src/Core/Types.h b/src/Core/Types.h index 92546d7d07a..0dfc089f144 100644 --- a/src/Core/Types.h +++ b/src/Core/Types.h @@ -42,11 +42,6 @@ struct Null } }; -/// Ignore strange gcc warning https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55776 -#if !defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" -#endif /// @note Except explicitly described you should not assume on TypeIndex numbers and/or their orders in this enum. enum class TypeIndex { @@ -89,9 +84,6 @@ enum class TypeIndex Map, Object, }; -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif using UInt128 = ::UInt128; diff --git a/src/Disks/tests/gtest_disk.cpp b/src/Disks/tests/gtest_disk.cpp index 36f91249391..908e76b5c63 100644 --- a/src/Disks/tests/gtest_disk.cpp +++ b/src/Disks/tests/gtest_disk.cpp @@ -7,12 +7,6 @@ namespace fs = std::filesystem; -#if !defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-override" -#endif - - template DB::DiskPtr createDisk(); diff --git a/src/Functions/GatherUtils/Sources.h b/src/Functions/GatherUtils/Sources.h index 13e3de99552..b78e70975c6 100644 --- a/src/Functions/GatherUtils/Sources.h +++ b/src/Functions/GatherUtils/Sources.h @@ -140,17 +140,12 @@ struct NumericArraySource : public ArraySourceImpl> /// The methods can be virtual or not depending on the template parameter. See IStringSource. -#if !defined(__clang__) -# pragma GCC diagnostic push +#pragma GCC diagnostic push +#ifdef HAS_SUGGEST_OVERRIDE # pragma GCC diagnostic ignored "-Wsuggest-override" -#elif __clang_major__ >= 11 -# pragma GCC diagnostic push -# ifdef HAS_SUGGEST_OVERRIDE -# pragma GCC diagnostic ignored "-Wsuggest-override" -# endif -# ifdef HAS_SUGGEST_DESTRUCTOR_OVERRIDE -# pragma GCC diagnostic ignored "-Wsuggest-destructor-override" -# endif +#endif +#ifdef HAS_SUGGEST_DESTRUCTOR_OVERRIDE +# pragma GCC diagnostic ignored "-Wsuggest-destructor-override" #endif template @@ -233,9 +228,7 @@ struct ConstSource : public Base } }; -#if !defined(__clang__) || __clang_major__ >= 11 -# pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop struct StringSource { diff --git a/src/Functions/PolygonUtils.h b/src/Functions/PolygonUtils.h index de4bb2d48de..c16db1d1ff7 100644 --- a/src/Functions/PolygonUtils.h +++ b/src/Functions/PolygonUtils.h @@ -12,11 +12,6 @@ /// Warning in boost::geometry during template strategy substitution. #pragma GCC diagnostic push - -#if !defined(__clang__) -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - #pragma GCC diagnostic ignored "-Wunused-parameter" #include @@ -286,16 +281,9 @@ void PointInPolygonWithGrid::calcGridAttributes( const Point & min_corner = box.min_corner(); const Point & max_corner = box.max_corner(); -#pragma GCC diagnostic push -#if !defined(__clang__) -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - cell_width = (max_corner.x() - min_corner.x()) / grid_size; cell_height = (max_corner.y() - min_corner.y()) / grid_size; -#pragma GCC diagnostic pop - if (cell_width == 0 || cell_height == 0) { has_empty_bound = true; @@ -330,10 +318,6 @@ void PointInPolygonWithGrid::buildGrid() for (size_t row = 0; row < grid_size; ++row) { -#pragma GCC diagnostic push -#if !defined(__clang__) -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif CoordinateType y_min = min_corner.y() + row * cell_height; CoordinateType y_max = min_corner.y() + (row + 1) * cell_height; @@ -341,7 +325,6 @@ void PointInPolygonWithGrid::buildGrid() { CoordinateType x_min = min_corner.x() + col * cell_width; CoordinateType x_max = min_corner.x() + (col + 1) * cell_width; -#pragma GCC diagnostic pop Box cell_box(Point(x_min, y_min), Point(x_max, y_max)); MultiPolygon intersection; diff --git a/src/IO/parseDateTimeBestEffort.cpp b/src/IO/parseDateTimeBestEffort.cpp index df3f02708a9..cc0cf2576a6 100644 --- a/src/IO/parseDateTimeBestEffort.cpp +++ b/src/IO/parseDateTimeBestEffort.cpp @@ -45,12 +45,6 @@ inline size_t readAlpha(char * res, size_t max_chars, ReadBuffer & in) return num_chars; } -#if defined(__PPC__) -#if !defined(__clang__) -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif -#endif - template inline void readDecimalNumberImpl(T & res, const char * src) { @@ -656,12 +650,6 @@ ReturnType parseDateTime64BestEffortImpl(DateTime64 & res, UInt32 scale, ReadBuf } -#if defined(__PPC__) -#if !defined(__clang__) -#pragma GCC diagnostic pop -#endif -#endif - void parseDateTimeBestEffort(time_t & res, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone) { parseDateTimeBestEffortImpl(res, in, local_time_zone, utc_time_zone, nullptr); diff --git a/src/Storages/MergeTree/DataPartStorageOnDisk.cpp b/src/Storages/MergeTree/DataPartStorageOnDisk.cpp index bb9aab3c9b6..5245bc89e0c 100644 --- a/src/Storages/MergeTree/DataPartStorageOnDisk.cpp +++ b/src/Storages/MergeTree/DataPartStorageOnDisk.cpp @@ -354,18 +354,11 @@ void DataPartStorageOnDisk::clearDirectory( /// Remove each expected file in directory, then remove directory itself. RemoveBatchRequest request; -#if !defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -#endif for (const auto & [file, _] : checksums.files) { if (skip_directories.find(file) == skip_directories.end()) request.emplace_back(fs::path(dir) / file); } -#if !defined(__clang__) -# pragma GCC diagnostic pop -#endif for (const auto & file : {"checksums.txt", "columns.txt"}) request.emplace_back(fs::path(dir) / file); diff --git a/src/Storages/tests/gtest_storage_log.cpp b/src/Storages/tests/gtest_storage_log.cpp index 3fa2f93b484..f1079a9ee10 100644 --- a/src/Storages/tests/gtest_storage_log.cpp +++ b/src/Storages/tests/gtest_storage_log.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -18,18 +16,12 @@ #include #include #include -#include #include #include #include #include #include -#if !defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-override" -#endif - DB::StoragePtr createStorage(DB::DiskPtr & disk) {