Skip to content

Commit

Permalink
Add support for clang-11 and gcc-10 (hyrise#2248)
Browse files Browse the repository at this point in the history
To enable brew upgrade, I fixed the issues that came up with clang-11. Nothing big, details can be found in the comments.

This does not yet add gcc-10/clang-11 to any dependencies. It also does not fix any issues that clang-tidy-11 might complain about.

This was tested on OS X 10.15.6 and Ubuntu 20.10 dev.
  • Loading branch information
mrks authored Oct 23, 2020
1 parent da83f75 commit 8f43cbc
Show file tree
Hide file tree
Showing 45 changed files with 470 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url = https://github.com/google/benchmark.git
[submodule "third_party/cpp-btree"]
path = third_party/cpp-btree
url = https://github.com/algorithm-ninja/cpp-btree
url = https://github.com/mrks/cpp-btree
[submodule "third_party/cpplint"]
path = third_party/cpplint
url = https://github.com/cpplint/cpplint.git
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exitcode=0

find src \( -iname "*.cpp" -o -iname "*.hpp" \) -a -not -path "src/lib/utils/boost_curry_override.hpp" -print0 | parallel --null --no-notice -j 100% --nice 17 /usr/bin/env python3 ./third_party/cpplint/cpplint.py --verbose=0 --extensions=hpp,cpp --counting=detailed --filter=-legal/copyright,-whitespace/newline,-runtime/references,-build/c++11,-build/include_what_you_use,-readability/nolint,-whitespace/braces --linelength=120 {} 2\>\&1 \| grep -v \'\^Done processing\' \| grep -v \'\^Total errors found: 0\' \; test \${PIPESTATUS[0]} -eq 0
find src \( -iname "*.cpp" -o -iname "*.hpp" \) -a -not -path "src/lib/utils/boost_curry_override.hpp" -a -not -path "src/lib/utils/boost_bimap_core_override.hpp" -print0 | parallel --null --no-notice -j 100% --nice 17 /usr/bin/env python3 ./third_party/cpplint/cpplint.py --verbose=0 --extensions=hpp,cpp --counting=detailed --filter=-legal/copyright,-whitespace/newline,-runtime/references,-build/c++11,-build/include_what_you_use,-readability/nolint,-whitespace/braces --linelength=120 {} 2\>\&1 \| grep -v \'\^Done processing\' \| grep -v \'\^Total errors found: 0\' \; test \${PIPESTATUS[0]} -eq 0
let "exitcode |= $?"
# /------------------ runs in parallel -------------------\
# Conceptual: find | parallel python cpplint \| grep -v \| test \${PIPESTATUS[0]} -eq 0
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (NOT "${HYRISE_RELAXED_BUILD}")
# -Wno-deprecated-dynamic-exception-spec is needed for jemalloc, at least for the older version that we are using

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-Weverything -Wshadow-all -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation -Wno-padded -Wno-global-constructors -Wno-sign-conversion -Wno-exit-time-destructors -Wno-switch-enum -Wno-weak-vtables -Wno-double-promotion -Wno-covered-switch-default -Wno-unused-macros -Wno-newline-eof -Wno-missing-variable-declarations -Wno-weak-template-vtables -Wno-missing-prototypes -Wno-float-equal -Wno-return-std-move-in-c++11 -Wno-unreachable-code-break -Wno-undefined-func-template -Wno-unknown-warning-option -Wno-pass-failed -Wno-ctad-maybe-unsupported -Wno-header-hygiene -Wno-poison-system-directories)
add_compile_options(-Weverything -Wshadow-all -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation -Wno-padded -Wno-global-constructors -Wno-sign-conversion -Wno-exit-time-destructors -Wno-switch-enum -Wno-weak-vtables -Wno-double-promotion -Wno-covered-switch-default -Wno-unused-macros -Wno-newline-eof -Wno-missing-variable-declarations -Wno-weak-template-vtables -Wno-missing-prototypes -Wno-float-equal -Wno-return-std-move-in-c++11 -Wno-unreachable-code-break -Wno-undefined-func-template -Wno-unknown-warning-option -Wno-pass-failed -Wno-ctad-maybe-unsupported -Wno-header-hygiene -Wno-poison-system-directories -Wno-zero-as-null-pointer-constant)
endif()

else()
Expand All @@ -79,7 +79,7 @@ include_directories(
SYSTEM
${TBB_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/third_party/benchmark/include
${PROJECT_SOURCE_DIR}/third_party/cpp-btree
${PROJECT_SOURCE_DIR}/third_party/cpp-btree/include/btree
${PROJECT_SOURCE_DIR}/third_party/cxxopts/include
${PROJECT_SOURCE_DIR}/third_party/flat_hash_map
${PROJECT_SOURCE_DIR}/third_party/json
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark/tpch_data_micro_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TableWrapper;
// Defining the base fixture class
class TPCHDataMicroBenchmarkFixture : public MicroBenchmarkBasicFixture {
public:
void SetUp(::benchmark::State& state) {
void SetUp(::benchmark::State& state) override {
auto& sm = Hyrise::get().storage_manager;
const auto scale_factor = 0.01f;
const auto default_encoding = EncodingType::Dictionary;
Expand Down Expand Up @@ -87,7 +87,7 @@ class TPCHDataMicroBenchmarkFixture : public MicroBenchmarkBasicFixture {
}

// Required to avoid resetting of StorageManager in MicroBenchmarkBasicFixture::TearDown()
void TearDown(::benchmark::State&) {}
void TearDown(::benchmark::State&) override {}

std::map<std::string, std::shared_ptr<TableWrapper>> create_table_wrappers(StorageManager& sm) {
std::map<std::string, std::shared_ptr<TableWrapper>> wrapper_map;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/console/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Console : public Singleton<Console> {
* Non-public constructor, since Console is a Singleton.
*/
Console();
~Console();
~Console() override;

friend class Singleton;

Expand Down
1 change: 1 addition & 0 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ set(
utils/abstract_plugin.hpp
utils/aligned_size.hpp
utils/assert.hpp
utils/boost_bimap_core_override.hpp
utils/boost_curry_override.hpp
utils/check_table_equal.cpp
utils/check_table_equal.hpp
Expand Down
16 changes: 8 additions & 8 deletions src/lib/cache/gdfs_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GDFSCache : public AbstractCache<Key, Value> {

explicit GDFSCache(size_t capacity = DEFAULT_CACHE_CAPACITY) : AbstractCache<Key, Value>(capacity), _inflation(0.0) {}

void set(const Key& key, const Value& value, double cost = 1.0, double size = 1.0) {
void set(const Key& key, const Value& value, double cost = 1.0, double size = 1.0) final {
std::unique_lock<std::shared_mutex> lock(_mutex);
if (this->_capacity == 0) return;
auto it = _map.find(key);
Expand Down Expand Up @@ -66,7 +66,7 @@ class GDFSCache : public AbstractCache<Key, Value> {
_map[key] = handle;
}

std::optional<Value> try_get(const Key& query) {
std::optional<Value> try_get(const Key& query) final {
std::unique_lock<std::shared_mutex> lock(_mutex);
auto it = _map.find(query);
if (it == _map.end()) return std::nullopt;
Expand All @@ -79,31 +79,31 @@ class GDFSCache : public AbstractCache<Key, Value> {
return entry.value;
}

bool has(const Key& key) const {
bool has(const Key& key) const final {
std::shared_lock<std::shared_mutex> lock(_mutex);
return _map.contains(key);
}

size_t size() const {
size_t size() const final {
std::shared_lock<std::shared_mutex> lock(_mutex);
return _map.size();
}

void clear() {
void clear() final {
std::unique_lock<std::shared_mutex> lock(_mutex);
_map.clear();
_queue.clear();
}

void resize(size_t capacity) {
void resize(size_t capacity) final {
std::unique_lock<std::shared_mutex> lock(_mutex);
while (_queue.size() > capacity) {
_evict();
}
this->_capacity = capacity;
}

std::unordered_map<Key, SnapshotEntry> snapshot() const {
std::unordered_map<Key, SnapshotEntry> snapshot() const final {
std::shared_lock<std::shared_mutex> lock(_mutex);
std::unordered_map<Key, SnapshotEntry> map_copy(_map.size());
for (const auto& [key, entry] : _map) {
Expand Down Expand Up @@ -133,7 +133,7 @@ class GDFSCache : public AbstractCache<Key, Value> {
// Inflation value that will be updated whenever an item is evicted.
double _inflation;

void _evict() {
void _evict() final {
auto top = _queue.top();

_inflation = top.priority;
Expand Down
9 changes: 0 additions & 9 deletions src/lib/operators/abstract_join_operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ class AbstractJoinOperator : public AbstractReadOnlyOperator {

std::shared_ptr<Table> _build_output_table(std::vector<std::shared_ptr<Chunk>>&& chunks,
const TableType table_type = TableType::References) const;

// Some operators need an internal implementation class, mostly in cases where
// their execute method depends on a template parameter. An example for this is
// found in join_hash.hpp.
class AbstractJoinOperatorImpl : public AbstractReadOnlyOperatorImpl {
public:
virtual ~AbstractJoinOperatorImpl() = default;
virtual std::shared_ptr<const Table> _on_execute() = 0;
};
};

} // namespace opossum
2 changes: 1 addition & 1 deletion src/lib/operators/join_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ std::shared_ptr<const Table> JoinHash::_on_execute() {
void JoinHash::_on_cleanup() { _impl.reset(); }

template <typename BuildColumnType, typename ProbeColumnType>
class JoinHash::JoinHashImpl : public AbstractJoinOperatorImpl {
class JoinHash::JoinHashImpl : public AbstractReadOnlyOperatorImpl {
public:
JoinHashImpl(const JoinHash& join_hash, const std::shared_ptr<const Table>& build_input_table,
const std::shared_ptr<const Table>& probe_input_table, const JoinMode mode,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/operators/join_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class JoinIndex : public AbstractJoinOperator {
enum class OperatorSteps : uint8_t { IndexJoining, NestedLoopJoining, OutputWriting };

struct PerformanceData : public OperatorPerformanceData<OperatorSteps> {
void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const;
void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const override;

size_t chunks_scanned_with_index{0};
size_t chunks_scanned_without_index{0};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/operators/join_sort_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const std::string& JoinSortMerge::name() const {
** Start of implementation.
**/
template <typename T>
class JoinSortMerge::JoinSortMergeImpl : public AbstractJoinOperatorImpl {
class JoinSortMerge::JoinSortMergeImpl : public AbstractReadOnlyOperatorImpl {
public:
JoinSortMergeImpl<T>(JoinSortMerge& sort_merge_join, ColumnID left_column_id, ColumnID right_column_id,
const PredicateCondition op, JoinMode mode,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/operators/join_sort_merge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class JoinSortMerge : public AbstractJoinOperator {
template <typename T>
friend class JoinSortMergeImpl;

std::unique_ptr<AbstractJoinOperatorImpl> _impl;
std::unique_ptr<AbstractReadOnlyOperatorImpl> _impl;
};

} // namespace opossum
2 changes: 1 addition & 1 deletion src/lib/operators/operator_performance_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct AbstractOperatorPerformanceData : public Noncopyable {
*/
template <typename Steps>
struct OperatorPerformanceData : public AbstractOperatorPerformanceData {
void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const {
void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const override {
if (!executed) {
stream << "Not executed.";
return;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/operators/table_scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TableScan : public AbstractReadOnlyOperator {
size_t chunk_scans_skipped{0};
size_t chunk_scans_sorted{0};

void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const {
void output_to_stream(std::ostream& stream, DescriptionMode description_mode) const override {
if (chunk_scans_skipped == 0 && chunk_scans_sorted == 0) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class AdaptiveRadixTreeIndex : public AbstractIndex {

AdaptiveRadixTreeIndex(AdaptiveRadixTreeIndex&&) = default;

virtual ~AdaptiveRadixTreeIndex() = default;

/**
*All keys in the ART have to be binary comparable in the sense that if the most significant differing bit between
*BinaryComparable a and BinaryComparable b is greater for a <=> a > b.
Expand Down Expand Up @@ -83,7 +81,7 @@ class AdaptiveRadixTreeIndex : public AbstractIndex {
std::shared_ptr<ARTNode> _bulk_insert(const std::vector<std::pair<BinaryComparable, ChunkOffset>>& values,
size_t depth, Iterator& it);

std::vector<std::shared_ptr<const AbstractSegment>> _get_indexed_segments() const;
std::vector<std::shared_ptr<const AbstractSegment>> _get_indexed_segments() const final;

size_t _memory_consumption() const final;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class CompositeGroupKeyIndex : public AbstractIndex {
static size_t estimate_memory_consumption(ChunkOffset row_count, ChunkOffset distinct_count, uint32_t value_bytes);

CompositeGroupKeyIndex(CompositeGroupKeyIndex&&) = default;
~CompositeGroupKeyIndex() = default;

explicit CompositeGroupKeyIndex(const std::vector<std::shared_ptr<const AbstractSegment>>& segments_to_index);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/storage/index/group_key/group_key_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class GroupKeyIndex : public AbstractIndex {
*/
Iterator _get_positions_iterator_at(ValueID value_id) const;

std::vector<std::shared_ptr<const AbstractSegment>> _get_indexed_segments() const;
std::vector<std::shared_ptr<const AbstractSegment>> _get_indexed_segments() const override;

size_t _memory_consumption() const final;

Expand Down
18 changes: 9 additions & 9 deletions src/lib/storage/segment_iterables/segment_positions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class SegmentPosition final : public AbstractSegmentPosition<T> {
SegmentPosition(const T& value, const bool null_value, const ChunkOffset& chunk_offset)
: _value{value}, _null_value{null_value}, _chunk_offset{chunk_offset} {}

const T& value() const { return _value; }
bool is_null() const { return _null_value; }
ChunkOffset chunk_offset() const { return _chunk_offset; }
const T& value() const override { return _value; }
bool is_null() const override { return _null_value; }
ChunkOffset chunk_offset() const override { return _chunk_offset; }

private:
// The alignment improves the suitability of the iterator for (auto-)vectorization
Expand All @@ -77,9 +77,9 @@ class NonNullSegmentPosition final : public AbstractSegmentPosition<T> {
NonNullSegmentPosition(const T& value, const ChunkOffset& chunk_offset)
: _value{value}, _chunk_offset{chunk_offset} {}

const T& value() const { return _value; }
bool is_null() const { return false; }
ChunkOffset chunk_offset() const { return _chunk_offset; }
const T& value() const override { return _value; }
bool is_null() const override { return false; }
ChunkOffset chunk_offset() const override { return _chunk_offset; }

private:
// The alignment improves the suitability of the iterator for (auto-)vectorization
Expand All @@ -101,9 +101,9 @@ class IsNullSegmentPosition final : public AbstractSegmentPosition<boost::blank>
IsNullSegmentPosition(const bool null_value, const ChunkOffset& chunk_offset)
: _null_value{null_value}, _chunk_offset{chunk_offset} {}

const boost::blank& value() const { return _blank; }
bool is_null() const { return _null_value; }
ChunkOffset chunk_offset() const { return _chunk_offset; }
const boost::blank& value() const override { return _blank; }
bool is_null() const override { return _null_value; }
ChunkOffset chunk_offset() const override { return _chunk_offset; }

private:
// The alignment improves the suitability of the iterator for (auto-)vectorization
Expand Down
2 changes: 1 addition & 1 deletion src/lib/storage/table_key_constraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TableKeyConstraint::TableKeyConstraint(std::unordered_set<ColumnID> init_columns
KeyConstraintType TableKeyConstraint::key_type() const { return _key_type; }

bool TableKeyConstraint::_on_equals(const AbstractTableConstraint& table_constraint) const {
DebugAssert(dynamic_cast<const AbstractTableConstraint*>(&table_constraint),
DebugAssert(dynamic_cast<const TableKeyConstraint*>(&table_constraint),
"Different table_constraint type should have been caught by AbstractTableConstraint::operator==");
return key_type() == static_cast<const TableKeyConstraint&>(table_constraint).key_type();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class FixedSizeByteAlignedVector : public CompressedVector<FixedSizeByteAlignedV

public:
explicit FixedSizeByteAlignedVector(pmr_vector<UnsignedIntType> data) : _data{std::move(data)} {}
~FixedSizeByteAlignedVector() = default;

const pmr_vector<UnsignedIntType>& data() const { return _data; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SimdBp128Decompressor : public BaseVectorDecompressor {
SimdBp128Decompressor& operator=(const SimdBp128Decompressor& other);
SimdBp128Decompressor& operator=(SimdBp128Decompressor&& other) noexcept;

~SimdBp128Decompressor() = default;
~SimdBp128Decompressor() override = default;

uint32_t get(const size_t i) final {
if (_is_index_within_cached_block(i)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace opossum {
class SimdBp128Vector : public CompressedVector<SimdBp128Vector> {
public:
explicit SimdBp128Vector(pmr_vector<uint128_t> vector, size_t size);
~SimdBp128Vector() = default;
~SimdBp128Vector() override = default;

const pmr_vector<uint128_t>& data() const;

Expand Down
5 changes: 5 additions & 0 deletions src/lib/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <tuple>
#include <vector>

#include <boost/version.hpp>
#if BOOST_VERSION < 107400 // TODO(anyone): remove this block once Ubuntu ships boost 1.74
#include "utils/boost_bimap_core_override.hpp" // NOLINT
#endif

#include <boost/bimap.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/container/pmr/polymorphic_allocator.hpp>
Expand Down
Loading

0 comments on commit 8f43cbc

Please sign in to comment.