From 82e18ec242aa33e92be55ad14107995b7c1fb1f2 Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Mon, 26 Feb 2024 21:32:27 -0500 Subject: [PATCH 1/2] Fix windows C++ build --- cpp/perspective/src/cpp/storage_impl_linux.cpp | 2 +- cpp/perspective/src/cpp/storage_impl_osx.cpp | 2 +- cpp/perspective/src/cpp/storage_impl_win.cpp | 2 +- cpp/perspective/src/include/perspective/storage.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/perspective/src/cpp/storage_impl_linux.cpp b/cpp/perspective/src/cpp/storage_impl_linux.cpp index 2a203afbae..d17d76f384 100644 --- a/cpp/perspective/src/cpp/storage_impl_linux.cpp +++ b/cpp/perspective/src/cpp/storage_impl_linux.cpp @@ -84,7 +84,7 @@ t_lstore::create_file() { } void* -t_lstore::create_mapping() const { +t_lstore::create_mapping() { void* rval = mmap(0, capacity(), m_mprot, m_mflags, m_fd, 0); PSP_VERBOSE_ASSERT(rval != MAP_FAILED, "mmap failed"); return rval; diff --git a/cpp/perspective/src/cpp/storage_impl_osx.cpp b/cpp/perspective/src/cpp/storage_impl_osx.cpp index b310bb19e0..83e9e1aa25 100644 --- a/cpp/perspective/src/cpp/storage_impl_osx.cpp +++ b/cpp/perspective/src/cpp/storage_impl_osx.cpp @@ -84,7 +84,7 @@ t_lstore::create_file() { } void* -t_lstore::create_mapping() const { +t_lstore::create_mapping() { void* rval = mmap(nullptr, capacity(), m_mprot, m_mflags, m_fd, 0); PSP_VERBOSE_ASSERT(rval, != MAP_FAILED, "mmap failed"); return rval; diff --git a/cpp/perspective/src/cpp/storage_impl_win.cpp b/cpp/perspective/src/cpp/storage_impl_win.cpp index b1d467fcc3..59a457228d 100644 --- a/cpp/perspective/src/cpp/storage_impl_win.cpp +++ b/cpp/perspective/src/cpp/storage_impl_win.cpp @@ -93,7 +93,7 @@ t_lstore::create_file() { } void* -t_lstore::create_mapping() const { +t_lstore::create_mapping() { std::pair capacity = capacity_pair(); m_winmapping_handle = CreateFileMapping( diff --git a/cpp/perspective/src/include/perspective/storage.h b/cpp/perspective/src/include/perspective/storage.h index 811215c16b..a556061f55 100644 --- a/cpp/perspective/src/include/perspective/storage.h +++ b/cpp/perspective/src/include/perspective/storage.h @@ -240,7 +240,7 @@ class PERSPECTIVE_MPROTECT_EXPORT t_lstore : public t_debug_helper private: void reserve_impl(t_uindex capacity, bool allow_shrink); t_handle create_file(); - void* create_mapping() const; + void* create_mapping(); void resize_mapping(t_uindex cap_new); void destroy_mapping(); From 343c927d8f6a46ac27987c7aa1ff7f1c692c6ffa Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Mon, 26 Feb 2024 21:38:30 -0500 Subject: [PATCH 2/2] Use LLVM 17 --- .clang-format | 29 ++++++++++--------- .github/workflows/build.yml | 20 ++++++------- cpp/perspective/src/cpp/arrow_csv.cpp | 15 ++++++---- cpp/perspective/src/cpp/computed_function.cpp | 9 ++++-- cpp/perspective/src/cpp/date_parser.cpp | 3 +- cpp/perspective/src/cpp/gnode.cpp | 3 +- .../src/cpp/storage_impl_linux.cpp | 1 + cpp/perspective/src/cpp/storage_impl_osx.cpp | 1 + .../vendor/arrow_single_threaded_reader.cpp | 22 +++++++++----- .../src/cpp/vendor/single_threaded_reader.cpp | 14 +++++---- .../src/include/perspective/date.h | 15 ++-------- .../src/include/perspective/storage.h | 1 + .../src/include/perspective/time.h | 3 +- python/perspective/perspective/src/numpy.cpp | 3 +- python/perspective/perspective/src/view.cpp | 3 +- 15 files changed, 79 insertions(+), 63 deletions(-) diff --git a/.clang-format b/.clang-format index ca1ed8c42b..c7010b9782 100644 --- a/.clang-format +++ b/.clang-format @@ -27,11 +27,11 @@ AlignConsecutiveMacros: AcrossComments: false AlignCompound: false PadOperators: false -# AlignConsecutiveShortCaseStatements: -# Enabled: false -# AcrossEmptyLines: false -# AcrossComments: false -# AlignCaseColons: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false AlignEscapedNewlines: Right AlignOperands: DontAlign AlignTrailingComments: @@ -141,7 +141,7 @@ IntegerLiteralSeparator: JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true -# KeepEmptyLinesAtEOF: false +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature LineEnding: LF MacroBlockBegin: "" @@ -170,6 +170,7 @@ QualifierAlignment: Leave ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false +RemoveParentheses: Leave RemoveSemicolon: false RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope @@ -187,7 +188,7 @@ SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true -# SpaceBeforeJsonColon: false +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements SpaceBeforeParensOptions: AfterControlStatements: true @@ -208,12 +209,12 @@ SpacesInContainerLiterals: true SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -# SpacesInParens: Never -# SpacesInParensOptions: -# InCStyleCasts: false -# InConditionalStatements: false -# InEmptyParentheses: false -# Other: false +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false Standard: c++17 StatementAttributeLikeMacros: @@ -223,7 +224,7 @@ StatementMacros: - QT_REQUIRE_VERSION TabWidth: 4 UseTab: Never -# VerilogBreakBetweenInstancePorts: true +VerilogBreakBetweenInstancePorts: true WhitespaceSensitiveMacros: - BOOST_PP_STRINGIZE - CF_SWIFT_NAME diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a972297d56..e4e672f468 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -307,10 +307,10 @@ jobs: # Dependencies # ################ ################ - - name: Install LLVM 16 + - name: Install LLVM 17 uses: KyleMayes/install-llvm-action@v1 with: - version: "16" + version: "17" directory: "./.llvm" # JS @@ -462,10 +462,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install LLVM and Clang + - name: Install LLVM 17 uses: KyleMayes/install-llvm-action@v1 with: - version: "16" + version: "17" directory: "./.llvm" ########## @@ -1067,12 +1067,12 @@ jobs: # Dependencies # ################ ################ - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - if: false - with: - version: "16" - directory: "./.llvm" + # - name: Install LLVM 17 + # uses: KyleMayes/install-llvm-action@v1 + # if: false + # with: + # version: "17" + # directory: "./.llvm" # JS - name: Install yarn diff --git a/cpp/perspective/src/cpp/arrow_csv.cpp b/cpp/perspective/src/cpp/arrow_csv.cpp index 3a676eab3b..373818c82f 100644 --- a/cpp/perspective/src/cpp/arrow_csv.cpp +++ b/cpp/perspective/src/cpp/arrow_csv.cpp @@ -74,7 +74,8 @@ ParseYYYY_MM_DD(const char* s, arrow_vendored::date::year_month_day* out) { *out = { arrow_vendored::date::year{year}, arrow_vendored::date::month{month}, - arrow_vendored::date::day{day}}; + arrow_vendored::date::day{day} + }; return out->ok(); } @@ -99,7 +100,8 @@ ParseYYYY_DD_MM(const char* s, arrow_vendored::date::year_month_day* out) { *out = { arrow_vendored::date::year{year}, arrow_vendored::date::month{month}, - arrow_vendored::date::day{day}}; + arrow_vendored::date::day{day} + }; return out->ok(); } @@ -125,7 +127,8 @@ ParseYYYY_D_M(const char* s, arrow_vendored::date::year_month_day* out) { *out = { arrow_vendored::date::year{year}, arrow_vendored::date::month{month}, - arrow_vendored::date::day{day}}; + arrow_vendored::date::day{day} + }; return out->ok(); } @@ -390,7 +393,8 @@ std::vector> DATE_PARSERS{ arrow::TimestampParser::MakeStrptime("%m/%d/%Y"), arrow::TimestampParser::MakeStrptime("%d %m %Y"), // TODO: time type column - arrow::TimestampParser::MakeStrptime("%H:%M:%S.%f")}; + arrow::TimestampParser::MakeStrptime("%H:%M:%S.%f") +}; std::vector> DATE_READERS{ std::make_shared(), @@ -402,7 +406,8 @@ std::vector> DATE_READERS{ arrow::TimestampParser::MakeStrptime("%m-%d-%Y"), arrow::TimestampParser::MakeStrptime("%m/%d/%Y"), arrow::TimestampParser::MakeStrptime("%d %m %Y"), - arrow::TimestampParser::MakeStrptime("%H:%M:%S.%f")}; + arrow::TimestampParser::MakeStrptime("%H:%M:%S.%f") +}; int64_t parseAsArrowTimestamp(const std::string& input) { diff --git a/cpp/perspective/src/cpp/computed_function.cpp b/cpp/perspective/src/cpp/computed_function.cpp index 371cc8e566..e70f42e961 100644 --- a/cpp/perspective/src/cpp/computed_function.cpp +++ b/cpp/perspective/src/cpp/computed_function.cpp @@ -975,7 +975,8 @@ const std::string days_of_week[7] = { "4 Wednesday", "5 Thursday", "6 Friday", - "7 Saturday"}; + "7 Saturday" +}; const std::string months_of_year[12] = { "01 January", @@ -989,7 +990,8 @@ const std::string months_of_year[12] = { "09 September", "10 October", "11 November", - "12 December"}; + "12 December" +}; day_of_week::day_of_week( t_expression_vocab& expression_vocab, bool is_type_validator @@ -1158,7 +1160,8 @@ tsl::hopscotch_map bucket::UNIT_MAP = { {'D', t_date_bucket_unit::DAYS}, {'W', t_date_bucket_unit::WEEKS}, {'M', t_date_bucket_unit::MONTHS}, - {'Y', t_date_bucket_unit::YEARS}}; + {'Y', t_date_bucket_unit::YEARS} +}; bucket::bucket() : exprtk::igeneric_function("T?") {} diff --git a/cpp/perspective/src/cpp/date_parser.cpp b/cpp/perspective/src/cpp/date_parser.cpp index ee9f56c495..a89f5113ee 100644 --- a/cpp/perspective/src/cpp/date_parser.cpp +++ b/cpp/perspective/src/cpp/date_parser.cpp @@ -31,7 +31,8 @@ const std::string t_date_parser::VALID_FORMATS[12] = { "%m %d %Y", "%m/%d/%Y", "%m/%d/%y", - "%d %m %Y"}; + "%d %m %Y" +}; t_date_parser::t_date_parser() {} diff --git a/cpp/perspective/src/cpp/gnode.cpp b/cpp/perspective/src/cpp/gnode.cpp index 7ea82bde03..121371e5b6 100644 --- a/cpp/perspective/src/cpp/gnode.cpp +++ b/cpp/perspective/src/cpp/gnode.cpp @@ -82,7 +82,8 @@ t_gnode::t_gnode(t_schema input_schema, t_schema output_schema) : m_output_schema, m_output_schema, trans_schema, - existed_schema}; + existed_schema + }; m_epoch = std::chrono::high_resolution_clock::now(); } diff --git a/cpp/perspective/src/cpp/storage_impl_linux.cpp b/cpp/perspective/src/cpp/storage_impl_linux.cpp index d17d76f384..7c0f6ebd8c 100644 --- a/cpp/perspective/src/cpp/storage_impl_linux.cpp +++ b/cpp/perspective/src/cpp/storage_impl_linux.cpp @@ -84,6 +84,7 @@ t_lstore::create_file() { } void* +// NOLINTNEXTLINE t_lstore::create_mapping() { void* rval = mmap(0, capacity(), m_mprot, m_mflags, m_fd, 0); PSP_VERBOSE_ASSERT(rval != MAP_FAILED, "mmap failed"); diff --git a/cpp/perspective/src/cpp/storage_impl_osx.cpp b/cpp/perspective/src/cpp/storage_impl_osx.cpp index 83e9e1aa25..473adf4264 100644 --- a/cpp/perspective/src/cpp/storage_impl_osx.cpp +++ b/cpp/perspective/src/cpp/storage_impl_osx.cpp @@ -84,6 +84,7 @@ t_lstore::create_file() { } void* +// NOLINTNEXTLINE t_lstore::create_mapping() { void* rval = mmap(nullptr, capacity(), m_mprot, m_mflags, m_fd, 0); PSP_VERBOSE_ASSERT(rval, != MAP_FAILED, "mmap failed"); diff --git a/cpp/perspective/src/cpp/vendor/arrow_single_threaded_reader.cpp b/cpp/perspective/src/cpp/vendor/arrow_single_threaded_reader.cpp index b4539d9032..b891995095 100644 --- a/cpp/perspective/src/cpp/vendor/arrow_single_threaded_reader.cpp +++ b/cpp/perspective/src/cpp/vendor/arrow_single_threaded_reader.cpp @@ -108,7 +108,8 @@ namespace csv { std::shared_ptr type ) { return Column{ - std::move(col_name), col_index, false, std::move(type)}; + std::move(col_name), col_index, false, std::move(type) + }; } static Column @@ -308,7 +309,8 @@ namespace csv { block_index_++, is_final, bytes_skipped, - [](int64_t) { return Status::OK(); }}); + [](int64_t) { return Status::OK(); } + }); } partial_ = std::move(empty); } @@ -353,7 +355,8 @@ namespace csv { block_index_++, is_final, bytes_skipped, - std::move(consume_bytes)}); + std::move(consume_bytes) + }); } }; @@ -453,7 +456,8 @@ namespace csv { } views = { std::string_view(*straddling), - std::string_view(*block.buffer)}; + std::string_view(*block.buffer) + }; } else { views = {std::string_view(*block.buffer)}; } @@ -470,7 +474,8 @@ namespace csv { return ParsedBlock{ std::move(parser), block.block_index, - static_cast(parsed_size) + block.bytes_skipped}; + static_cast(parsed_size) + block.bytes_skipped + }; } private: @@ -736,8 +741,8 @@ namespace csv { ); } views = { - std::string_view(*straddling), - std::string_view(*block)}; + std::string_view(*straddling), std::string_view(*block) + }; } else { views = {std::string_view(*block)}; } @@ -751,7 +756,8 @@ namespace csv { num_rows_seen_ += parser->total_num_rows(); } return ParseResult{ - std::move(parser), static_cast(parsed_size)}; + std::move(parser), static_cast(parsed_size) + }; } io::IOContext io_context_; diff --git a/cpp/perspective/src/cpp/vendor/single_threaded_reader.cpp b/cpp/perspective/src/cpp/vendor/single_threaded_reader.cpp index 7e31270ff0..159a889bf9 100644 --- a/cpp/perspective/src/cpp/vendor/single_threaded_reader.cpp +++ b/cpp/perspective/src/cpp/vendor/single_threaded_reader.cpp @@ -1332,7 +1332,8 @@ namespace ipc { static inline FileBlock FileBlockFromFlatbuffer(const flatbuf::Block* block) { return FileBlock{ - block->offset(), block->metaDataLength(), block->bodyLength()}; + block->offset(), block->metaDataLength(), block->bodyLength() + }; } Status @@ -1542,7 +1543,8 @@ namespace ipc { )); } return RecordBatchWithMetadata{ - std::move(batch), std::move(custom_metadata)}; + std::move(batch), std::move(custom_metadata) + }; } RETURN_NOT_OK(WaitForDictionaryReadFinished()); @@ -2489,7 +2491,8 @@ namespace ipc { if (cached_source_) { auto cached_source = cached_source_; io::ReadRange range{ - block.offset, block.metadata_length + block.body_length}; + block.offset, block.metadata_length + block.body_length + }; auto* pool = state_->options_.memory_pool; return cached_source->WaitFor({range}).Then( [cached_source, pool, range]( @@ -3553,8 +3556,9 @@ namespace ipc { } else { // no real IO is performed, it is only saved into a vector for // replaying later - read_ranges_.emplace_back(io::ReadRange{ - position, num_bytes_read}); + read_ranges_.emplace_back( + io::ReadRange{position, num_bytes_read} + ); } return num_bytes_read; } diff --git a/cpp/perspective/src/include/perspective/date.h b/cpp/perspective/src/include/perspective/date.h index 863a7c9a41..95414b7fbc 100644 --- a/cpp/perspective/src/include/perspective/date.h +++ b/cpp/perspective/src/include/perspective/date.h @@ -24,19 +24,8 @@ namespace perspective { static const std::int32_t CUMULATIVE_DAYS[2][13] = { - {0, - 31, - 59, - 90, - 120, - 151, - 181, - 212, - 243, - 273, - 304, - 334, - 365} /* Normal years. */, + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 + } /* Normal years. */, {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} /* Leap years. */ diff --git a/cpp/perspective/src/include/perspective/storage.h b/cpp/perspective/src/include/perspective/storage.h index a556061f55..11c72322f8 100644 --- a/cpp/perspective/src/include/perspective/storage.h +++ b/cpp/perspective/src/include/perspective/storage.h @@ -240,6 +240,7 @@ class PERSPECTIVE_MPROTECT_EXPORT t_lstore : public t_debug_helper private: void reserve_impl(t_uindex capacity, bool allow_shrink); t_handle create_file(); + // NOLINTNEXTLINE void* create_mapping(); void resize_mapping(t_uindex cap_new); void destroy_mapping(); diff --git a/cpp/perspective/src/include/perspective/time.h b/cpp/perspective/src/include/perspective/time.h index b27861d835..149655ea4b 100644 --- a/cpp/perspective/src/include/perspective/time.h +++ b/cpp/perspective/src/include/perspective/time.h @@ -33,7 +33,8 @@ static unsigned short const int __mon_yday[2][13] = { /* Normal years. */ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, /* Leap years. */ - {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}}; + {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} +}; class t_time; // A simple difference in ms between two t_times can be diff --git a/python/perspective/perspective/src/numpy.cpp b/python/perspective/perspective/src/numpy.cpp index 4cb6c91f7d..09a1aca480 100644 --- a/python/perspective/perspective/src/numpy.cpp +++ b/python/perspective/perspective/src/numpy.cpp @@ -20,7 +20,8 @@ namespace perspective { namespace numpy { const std::vector NumpyLoader::DATE_UNITS = { - "[D]", "[W]", "[M]", "[Y]"}; + "[D]", "[W]", "[M]", "[Y]" + }; NumpyLoader::NumpyLoader(t_val accessor) : m_init(false), diff --git a/python/perspective/perspective/src/view.cpp b/python/perspective/perspective/src/view.cpp index e710883467..486566ba88 100644 --- a/python/perspective/perspective/src/view.cpp +++ b/python/perspective/perspective/src/view.cpp @@ -165,7 +165,8 @@ namespace binding { if (p_aggregates.contains(py_column_name)) { if (py::isinstance(p_aggregates[py_column_name])) { std::vector agg{ - p_aggregates[py_column_name].cast()}; + p_aggregates[py_column_name].cast() + }; aggregates[column] = agg; } else { aggregates[column] = p_aggregates[py_column_name]