Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

PRing the fixes for gcc-12 separately #153

Merged
merged 4 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ add_subdirectory(omniscidb/OSDependent)

include_directories(omniscidb/ThirdParty/rapidjson)
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
if(NOT MSVC)
# At the present time the current vcpkg version of rapidjson is 2020-09-14:
# https://github.com/microsoft/vcpkg/blob/master/versions/r-/rapidjson.json
# and the Windows build fails because it does not have this fix:
# https://github.com/Tencent/rapidjson/pull/1568
# Once vcpkg's rapidjson has this fix then let's try not making this exception for MSVC.
# When this changes, remove this exception from all other similar CMakeLists.txt files too.
add_definitions(-DRAPIDJSON_NOMEMBERITERATORCLASS)
endif()
include_directories(omniscidb/ThirdParty/googletest)
add_subdirectory(omniscidb/ThirdParty/googletest)

Expand Down
9 changes: 9 additions & 0 deletions omniscidb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,15 @@ endif()
# RapidJSON
include_directories(ThirdParty/rapidjson)
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
if(NOT MSVC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the comment, it looks like the fix is required for Windows but it is enabled for non-Windows builds. Also, the top level CMakeLists.txt directly includes rapidjson and therefore should require the same fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the fix is required for non-Windows builds -- the vcpkg version on Windows is too old for the fix to apply there as of this writing (which may have been some time ago). But, msvc doesn't seem to have an issue with the iterator format used in rapidjson -- perhaps because they are not enforcing all parts of c++17 yet?

# At the present time the current vcpkg version of rapidjson is 2020-09-14:
# https://github.com/microsoft/vcpkg/blob/master/versions/r-/rapidjson.json
# and the Windows build fails because it does not have this fix:
# https://github.com/Tencent/rapidjson/pull/1568
# Once vcpkg's rapidjson has this fix then let's try not making this exception for MSVC.
# When this changes, remove this exception from all other similar CMakeLists.txt files too.
add_definitions(-DRAPIDJSON_NOMEMBERITERATORCLASS)
endif()

# SQLite
include_directories(ThirdParty/sqlite3)
Expand Down
2 changes: 1 addition & 1 deletion omniscidb/QueryEngine/RelAlgExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ void collect_used_input_desc(
const hdk::ir::Node* ra_node,
const ColumnRefSet& source_used_inputs,
const std::unordered_map<const hdk::ir::Node*, int>& input_to_nest_level) {
for (const auto col_ref : source_used_inputs) {
for (const auto& col_ref : source_used_inputs) {
const auto source = col_ref.node();
const int table_id = table_id_from_ra(source);
const auto col_id = col_ref.index();
Expand Down
8 changes: 7 additions & 1 deletion omniscidb/Shared/DoubleSort.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ std::ostream& operator<<(std::ostream& out, Value<T0, T1> const& ds) {
#endif

template <typename T0, typename T1>
struct Iterator : public std::iterator<std::input_iterator_tag, Value<T0, T1>> {
struct Iterator {
using iterator_category = std::input_iterator_tag;
using value_type = Value<T0, T1>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Value<T0, T1> this_; // this_ is always a reference object. I.e. this_.ref_ == true.
DEVICE Iterator(T0* ptr0, T1* ptr1) : this_(ptr0, ptr1) {}
DEVICE Iterator(Iterator const& b) : this_(b.this_.v0_.ptr_, b.this_.v1_.ptr_) {}
Expand Down
8 changes: 7 additions & 1 deletion omniscidb/Shared/Intervals.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,19 @@ class Intervals {
}

public:
class Iterator : public std::iterator<std::input_iterator_tag, Interval<T>> {
class Iterator {
T begin_;
U const quot_;
U rem_;
U index{0};

public:
using iterator_category = std::input_iterator_tag;
using value_type = Interval<T>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

Iterator(T begin, U quot, U rem) : begin_(begin), quot_(quot), rem_(rem) {}
Interval<T> operator*() const {
return {begin_, T(begin_ + quot_ + bool(rem_)), index};
Expand Down