From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- external/liborcus/std-get-busted.patch.1 | 418 +++++++++++++++++++++++++++++++ 1 file changed, 418 insertions(+) create mode 100644 external/liborcus/std-get-busted.patch.1 (limited to 'external/liborcus/std-get-busted.patch.1') diff --git a/external/liborcus/std-get-busted.patch.1 b/external/liborcus/std-get-busted.patch.1 new file mode 100644 index 000000000..40b839f65 --- /dev/null +++ b/external/liborcus/std-get-busted.patch.1 @@ -0,0 +1,418 @@ +From f917ed284c52ae12fb0d752c17141f355158470e Mon Sep 17 00:00:00 2001 +From: Kohei Yoshida +Date: Tue, 2 Nov 2021 22:07:51 -0400 +Subject: [PATCH] std::get(...) may be flaky with some version of clang. + +As workaround, use boost::variant and boost::get. + +c.f. https://stackoverflow.com/questions/52521388/stdvariantget-does-not-compile-with-apple-llvm-10-0 +--- + include/orcus/config.hpp | 4 ++-- + include/orcus/css_selector.hpp | 5 +++-- + include/orcus/json_parser_thread.hpp | 4 ++-- + include/orcus/sax_token_parser_thread.hpp | 5 +++-- + include/orcus/spreadsheet/pivot.hpp | 7 ++++--- + include/orcus/threaded_json_parser.hpp | 8 ++++---- + include/orcus/threaded_sax_token_parser.hpp | 8 ++++---- + src/liborcus/css_document_tree.cpp | 2 +- + src/liborcus/css_selector.cpp | 12 ++++++------ + src/liborcus/orcus_csv.cpp | 4 ++-- + src/orcus_csv_main.cpp | 2 +- + src/orcus_test_csv.cpp | 8 ++++---- + src/orcus_test_xlsx.cpp | 4 ++-- + src/parser/json_parser_thread.cpp | 8 ++++---- + src/python/sheet_rows.cpp | 3 +++ + 15 files changed, 45 insertions(+), 39 deletions(-) + +diff --git a/include/orcus/config.hpp b/include/orcus/config.hpp +index 17743e6a..fe9a7d81 100644 +--- a/include/orcus/config.hpp ++++ b/include/orcus/config.hpp +@@ -12,7 +12,7 @@ + #include "orcus/types.hpp" + + #include +-#include ++#include + + namespace orcus { + +@@ -37,7 +37,7 @@ struct ORCUS_DLLPUBLIC config + }; + + // TODO: add config for other formats as needed. +- using data_type = std::variant; ++ using data_type = boost::variant; + + /** + * Enable or disable runtime debug output to stdout or stderr. +diff --git a/include/orcus/css_selector.hpp b/include/orcus/css_selector.hpp +index 1e41d544..dafeddf5 100644 +--- a/include/orcus/css_selector.hpp ++++ b/include/orcus/css_selector.hpp +@@ -12,11 +12,12 @@ + #include "css_types.hpp" + + #include +-#include + #include + #include + #include + ++#include ++ + namespace orcus { + + struct ORCUS_DLLPUBLIC css_simple_selector_t +@@ -73,7 +74,7 @@ struct ORCUS_DLLPUBLIC css_selector_t + */ + struct ORCUS_DLLPUBLIC css_property_value_t + { +- using value_type = std::variant; ++ using value_type = boost::variant; + + css::property_value_t type; + value_type value; +diff --git a/include/orcus/json_parser_thread.hpp b/include/orcus/json_parser_thread.hpp +index 8328ef11..565008da 100644 +--- a/include/orcus/json_parser_thread.hpp ++++ b/include/orcus/json_parser_thread.hpp +@@ -14,7 +14,7 @@ + #include + #include + #include +-#include ++#include + + namespace orcus { + +@@ -47,7 +47,7 @@ enum class parse_token_t + + struct ORCUS_PSR_DLLPUBLIC parse_token + { +- using value_type = std::variant; ++ using value_type = boost::variant; + + parse_token_t type; + value_type value; +diff --git a/include/orcus/sax_token_parser_thread.hpp b/include/orcus/sax_token_parser_thread.hpp +index b3645735..e0842013 100644 +--- a/include/orcus/sax_token_parser_thread.hpp ++++ b/include/orcus/sax_token_parser_thread.hpp +@@ -12,10 +12,11 @@ + #include "types.hpp" + + #include +-#include + #include + #include + ++#include ++ + namespace orcus { + + class tokens; +@@ -36,7 +37,7 @@ enum class parse_token_t + + struct ORCUS_PSR_DLLPUBLIC parse_token + { +- using value_type = std::variant; ++ using value_type = boost::variant; + + parse_token_t type; + value_type value; +diff --git a/include/orcus/spreadsheet/pivot.hpp b/include/orcus/spreadsheet/pivot.hpp +index dee25596..fa091160 100644 +--- a/include/orcus/spreadsheet/pivot.hpp ++++ b/include/orcus/spreadsheet/pivot.hpp +@@ -15,9 +15,10 @@ + #include + #include + #include +-#include + #include + ++#include ++ + namespace ixion { + + struct abs_range_t; +@@ -36,7 +37,7 @@ using pivot_cache_indices_t = std::vector; + + struct ORCUS_SPM_DLLPUBLIC pivot_cache_record_value_t + { +- using value_type = std::variant; ++ using value_type = boost::variant; + + enum class record_type + { +@@ -66,7 +67,7 @@ using pivot_cache_record_t = std::vector; + + struct ORCUS_SPM_DLLPUBLIC pivot_cache_item_t + { +- using value_type = std::variant; ++ using value_type = boost::variant; + + enum class item_type + { +diff --git a/include/orcus/threaded_json_parser.hpp b/include/orcus/threaded_json_parser.hpp +index 51cdaced..3bf6e591 100644 +--- a/include/orcus/threaded_json_parser.hpp ++++ b/include/orcus/threaded_json_parser.hpp +@@ -151,23 +151,23 @@ void threaded_json_parser<_Handler>::process_tokens(json::parse_tokens_t& tokens + m_handler.null(); + break; + case json::parse_token_t::number: +- m_handler.number(std::get(t.value)); ++ m_handler.number(boost::get(t.value)); + break; + case json::parse_token_t::object_key: + { +- auto s = std::get(t.value); ++ auto s = boost::get(t.value); + m_handler.object_key(s.data(), s.size(), false); + break; + } + case json::parse_token_t::string: + { +- auto s = std::get(t.value); ++ auto s = boost::get(t.value); + m_handler.string(s.data(), s.size(), false); + break; + } + case json::parse_token_t::parse_error: + { +- auto v = std::get(t.value); ++ auto v = boost::get(t.value); + throw json::parse_error(std::string{v.str}, v.offset); + } + case json::parse_token_t::unknown: +diff --git a/include/orcus/threaded_sax_token_parser.hpp b/include/orcus/threaded_sax_token_parser.hpp +index 59ea967a..1b389be2 100644 +--- a/include/orcus/threaded_sax_token_parser.hpp ++++ b/include/orcus/threaded_sax_token_parser.hpp +@@ -131,25 +131,25 @@ void threaded_sax_token_parser<_Handler>::process_tokens(const sax::parse_tokens + { + case sax::parse_token_t::start_element: + { +- const auto* elem = std::get(t.value); ++ const auto* elem = boost::get(t.value); + m_handler.start_element(*elem); + break; + } + case sax::parse_token_t::end_element: + { +- const auto* elem = std::get(t.value); ++ const auto* elem = boost::get(t.value); + m_handler.end_element(*elem); + break; + } + case sax::parse_token_t::characters: + { +- auto s = std::get(t.value); ++ auto s = boost::get(t.value); + m_handler.characters(s, false); + break; + } + case sax::parse_token_t::parse_error: + { +- auto v = std::get(t.value); ++ auto v = boost::get(t.value); + throw sax::malformed_xml_error(std::string{v.str}, v.offset); + } + default: +diff --git a/src/liborcus/css_document_tree.cpp b/src/liborcus/css_document_tree.cpp +index 46bf7e91..4b44edff 100644 +--- a/src/liborcus/css_document_tree.cpp ++++ b/src/liborcus/css_document_tree.cpp +@@ -317,7 +317,7 @@ public: + { + // String value needs interning. + css_property_value_t interned = v; +- auto s = std::get(v.value); ++ auto s = boost::get(v.value); + interned.value = m_sp.intern(s).first; + m_dest.push_back(interned); + break; +diff --git a/src/liborcus/css_selector.cpp b/src/liborcus/css_selector.cpp +index b7b63f37..de522062 100644 +--- a/src/liborcus/css_selector.cpp ++++ b/src/liborcus/css_selector.cpp +@@ -155,7 +155,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + { + case css::property_value_t::hsl: + { +- auto c = std::get(v.value); ++ auto c = boost::get(v.value); + os << "hsl(" + << (int)c.hue << sep + << (int)c.saturation << sep +@@ -165,7 +165,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::hsla: + { +- auto c = std::get(v.value); ++ auto c = boost::get(v.value); + os << "hsla(" + << (int)c.hue << sep + << (int)c.saturation << sep +@@ -176,7 +176,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::rgb: + { +- auto c = std::get(v.value); ++ auto c = boost::get(v.value); + os << "rgb(" + << (int)c.red << sep + << (int)c.green << sep +@@ -186,7 +186,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::rgba: + { +- auto c = std::get(v.value); ++ auto c = boost::get(v.value); + os << "rgba(" + << (int)c.red << sep + << (int)c.green << sep +@@ -196,10 +196,10 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + break; + } + case css::property_value_t::string: +- os << std::get(v.value); ++ os << boost::get(v.value); + break; + case css::property_value_t::url: +- os << "url(" << std::get(v.value) << ")"; ++ os << "url(" << boost::get(v.value) << ")"; + break; + case css::property_value_t::none: + default: +diff --git a/src/liborcus/orcus_csv.cpp b/src/liborcus/orcus_csv.cpp +index 5c71bcf5..637308ab 100644 +--- a/src/liborcus/orcus_csv.cpp ++++ b/src/liborcus/orcus_csv.cpp +@@ -63,7 +63,7 @@ public: + // 0. + if (m_row >= mp_sheet->get_sheet_size().rows) + { +- auto csv = std::get(m_app_config.data); ++ auto csv = boost::get(m_app_config.data); + + if (!csv.split_to_multiple_sheets) + throw max_row_size_reached(); +@@ -93,7 +93,7 @@ public: + + void cell(const char* p, size_t n, bool transient) + { +- auto csv = std::get(m_app_config.data); ++ auto csv = boost::get(m_app_config.data); + + if (m_sheet == 0 && size_t(m_row) < csv.header_row_size) + { +diff --git a/src/orcus_csv_main.cpp b/src/orcus_csv_main.cpp +index 4f6d7173..446f2684 100644 +--- a/src/orcus_csv_main.cpp ++++ b/src/orcus_csv_main.cpp +@@ -45,7 +45,7 @@ public: + + virtual void map_to_config(config& opt, const po::variables_map& vm) override + { +- auto csv = std::get(opt.data); ++ auto csv = boost::get(opt.data); + + if (vm.count("row-header")) + csv.header_row_size = vm["row-header"].as(); +diff --git a/src/orcus_test_csv.cpp b/src/orcus_test_csv.cpp +index 310ace9d..0b9ba994 100644 +--- a/src/orcus_test_csv.cpp ++++ b/src/orcus_test_csv.cpp +@@ -95,8 +95,8 @@ void test_csv_import_split_sheet() + std::cout << "checking " << path << "..." << std::endl; + + config conf(format_t::csv); +- std::get(conf.data).header_row_size = 0; +- std::get(conf.data).split_to_multiple_sheets = true; ++ boost::get(conf.data).header_row_size = 0; ++ boost::get(conf.data).split_to_multiple_sheets = true; + + // Set the row size to 11 to make sure the split occurs. + spreadsheet::range_size_t ss{11, 4}; +@@ -126,7 +126,7 @@ void test_csv_import_split_sheet() + path = dir; + path.append("input.csv"); + doc.clear(); +- std::get(conf.data).header_row_size = 1; ++ boost::get(conf.data).header_row_size = 1; + { + spreadsheet::import_factory factory(doc); + orcus_csv app(&factory); +@@ -149,7 +149,7 @@ void test_csv_import_split_sheet() + + // Re-import it again, but this time disable the splitting. The data should + // get trucated on the first sheet. +- std::get(conf.data).split_to_multiple_sheets = false; ++ boost::get(conf.data).split_to_multiple_sheets = false; + + path = dir; + path.append("input.csv"); +diff --git a/src/orcus_test_xlsx.cpp b/src/orcus_test_xlsx.cpp +index 807c61e4..632fb1e7 100644 +--- a/src/orcus_test_xlsx.cpp ++++ b/src/orcus_test_xlsx.cpp +@@ -1154,8 +1154,8 @@ void test_xlsx_pivot_group_by_numbers() + for (const pivot_cache_item_t& item : fld->items) + { + assert(item.type == pivot_cache_item_t::item_type::numeric); +- assert(*fld->min_value <= std::get(item.value)); +- assert(std::get(item.value) <= *fld->max_value); ++ assert(*fld->min_value <= boost::get(item.value)); ++ assert(boost::get(item.value) <= *fld->max_value); + } + + // This field is also gruop field with 7 numeric intervals of width 2. +diff --git a/src/parser/json_parser_thread.cpp b/src/parser/json_parser_thread.cpp +index 36bbe6e6..65fb6255 100644 +--- a/src/parser/json_parser_thread.cpp ++++ b/src/parser/json_parser_thread.cpp +@@ -237,19 +237,19 @@ std::ostream& operator<< (std::ostream& os, const parse_tokens_t& tokens) + os << "- null" << endl; + break; + case parse_token_t::number: +- os << "- number (v=" << std::get(t.value) << ")" << endl; ++ os << "- number (v=" << boost::get(t.value) << ")" << endl; + break; + case parse_token_t::object_key: +- os << "- object_key (v=" << std::get(t.value) << ")" << endl; ++ os << "- object_key (v=" << boost::get(t.value) << ")" << endl; + break; + case parse_token_t::parse_error: + { +- auto v = std::get(t.value); ++ auto v = boost::get(t.value); + os << "- parse_error (v=" << v.str << ", offset=" << v.offset << ")" << endl; + break; + } + case parse_token_t::string: +- os << "- string (" << std::get(t.value) << ")" << endl; ++ os << "- string (" << boost::get(t.value) << ")" << endl; + break; + case parse_token_t::unknown: + os << "- unknown" << endl; +diff --git a/src/python/sheet_rows.cpp b/src/python/sheet_rows.cpp +index be495894..0d21ba71 100644 +--- a/src/python/sheet_rows.cpp ++++ b/src/python/sheet_rows.cpp +@@ -135,7 +135,10 @@ PyObject* sheet_rows_iternext(PyObject* self) + break; + } + case ixion::celltype_t::unknown: ++ { ++ PyErr_SetString(PyExc_RuntimeError, "Unknown cell type."); + break; ++ } + } + + if (!obj) +-- +2.25.1 + -- cgit v1.2.3