Dependencies update: cpuid 9, cxxopts 3.2.1 and pugixml 1.14

This commit is contained in:
redtide 2024-02-23 04:41:59 +01:00 committed by Paul Ferrand
parent 28e5130f44
commit 4b5d45f867
7 changed files with 1319 additions and 1180 deletions

View file

@ -27,6 +27,7 @@ THE SOFTWARE.
#ifndef CXXOPTS_HPP_INCLUDED
#define CXXOPTS_HPP_INCLUDED
#include <cstdlib>
#include <cstring>
#include <exception>
#include <limits>
@ -73,6 +74,14 @@ THE SOFTWARE.
# endif
#endif
#define CXXOPTS_FALLTHROUGH
#ifdef __has_cpp_attribute
#if __has_cpp_attribute(fallthrough)
#undef CXXOPTS_FALLTHROUGH
#define CXXOPTS_FALLTHROUGH [[fallthrough]]
#endif
#endif
#if __cplusplus >= 201603L
#define CXXOPTS_NODISCARD [[nodiscard]]
#else
@ -84,7 +93,7 @@ THE SOFTWARE.
#endif
#define CXXOPTS__VERSION_MAJOR 3
#define CXXOPTS__VERSION_MINOR 1
#define CXXOPTS__VERSION_MINOR 2
#define CXXOPTS__VERSION_PATCH 1
#if (__GNUC__ < 10 || (__GNUC__ == 10 && __GNUC_MINOR__ < 1)) && __GNUC__ >= 6
@ -230,10 +239,10 @@ stringAppend(String& s, Iterator begin, Iterator end)
}
inline
std::size_t
size_t
stringLength(const String& s)
{
return s.length();
return static_cast<size_t>(s.length());
}
inline
@ -337,13 +346,8 @@ empty(const std::string& s)
namespace cxxopts {
namespace {
#ifdef _WIN32
CXXOPTS_LINKONCE_CONST std::string LQUOTE("\'");
CXXOPTS_LINKONCE_CONST std::string RQUOTE("\'");
#else
CXXOPTS_LINKONCE_CONST std::string LQUOTE("");
CXXOPTS_LINKONCE_CONST std::string RQUOTE("");
#endif
} // namespace
// GNU GCC with -Weffc++ will issue a warning regarding the upcoming class, we
@ -365,6 +369,9 @@ class Value : public std::enable_shared_from_this<Value>
std::shared_ptr<Value>
clone() const = 0;
virtual void
add(const std::string& text) const = 0;
virtual void
parse(const std::string& text) const = 0;
@ -758,29 +765,31 @@ inline ArguDesc ParseArgument(const char *arg, bool &matched)
namespace {
CXXOPTS_LINKONCE
std::basic_regex<char> integer_pattern
("(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)");
const char* const integer_pattern =
"(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)";
CXXOPTS_LINKONCE
std::basic_regex<char> truthy_pattern
("(t|T)(rue)?|1");
const char* const truthy_pattern =
"(t|T)(rue)?|1";
CXXOPTS_LINKONCE
std::basic_regex<char> falsy_pattern
("(f|F)(alse)?|0");
const char* const falsy_pattern =
"(f|F)(alse)?|0";
CXXOPTS_LINKONCE
std::basic_regex<char> option_matcher
("--([[:alnum:]][-_[:alnum:]\\.]+)(=(.*))?|-([[:alnum:]].*)");
const char* const option_pattern =
"--([[:alnum:]][-_[:alnum:]\\.]+)(=(.*))?|-([[:alnum:]].*)";
CXXOPTS_LINKONCE
std::basic_regex<char> option_specifier
("([[:alnum:]][-_[:alnum:]\\.]*)(,[ ]*[[:alnum:]][-_[:alnum:]]*)*");
const char* const option_specifier_pattern =
"([[:alnum:]][-_[:alnum:]\\.]*)(,[ ]*[[:alnum:]][-_[:alnum:]]*)*";
CXXOPTS_LINKONCE
std::basic_regex<char> option_specifier_separator(", *");
const char* const option_specifier_separator_pattern = ", *";
} // namespace
inline IntegerDesc SplitInteger(const std::string &text)
{
static const std::basic_regex<char> integer_matcher(integer_pattern);
std::smatch match;
std::regex_match(text, match, integer_pattern);
std::regex_match(text, match, integer_matcher);
if (match.length() == 0)
{
@ -804,15 +813,17 @@ inline IntegerDesc SplitInteger(const std::string &text)
inline bool IsTrueText(const std::string &text)
{
static const std::basic_regex<char> truthy_matcher(truthy_pattern);
std::smatch result;
std::regex_match(text, result, truthy_pattern);
std::regex_match(text, result, truthy_matcher);
return !result.empty();
}
inline bool IsFalseText(const std::string &text)
{
static const std::basic_regex<char> falsy_matcher(falsy_pattern);
std::smatch result;
std::regex_match(text, result, falsy_pattern);
std::regex_match(text, result, falsy_matcher);
return !result.empty();
}
@ -821,22 +832,25 @@ inline bool IsFalseText(const std::string &text)
// (without considering which or how many are single-character)
inline OptionNames split_option_names(const std::string &text)
{
if (!std::regex_match(text.c_str(), option_specifier))
static const std::basic_regex<char> option_specifier_matcher(option_specifier_pattern);
if (!std::regex_match(text.c_str(), option_specifier_matcher))
{
throw_or_mimic<exceptions::invalid_option_format>(text);
}
OptionNames split_names;
static const std::basic_regex<char> option_specifier_separator_matcher(option_specifier_separator_pattern);
constexpr int use_non_matches { -1 };
auto token_iterator = std::sregex_token_iterator(
text.begin(), text.end(), option_specifier_separator, use_non_matches);
text.begin(), text.end(), option_specifier_separator_matcher, use_non_matches);
std::copy(token_iterator, std::sregex_token_iterator(), std::back_inserter(split_names));
return split_names;
}
inline ArguDesc ParseArgument(const char *arg, bool &matched)
{
static const std::basic_regex<char> option_matcher(option_pattern);
std::match_results<const char*> result;
std::regex_match(arg, result, option_matcher);
matched = !result.empty();
@ -959,13 +973,26 @@ integer_parser(const std::string& text, T& value)
throw_or_mimic<exceptions::incorrect_argument_type>(text);
}
const US next = static_cast<US>(result * base + digit);
if (result > next)
US limit = 0;
if (negative)
{
limit = static_cast<US>(std::abs(static_cast<intmax_t>(std::numeric_limits<T>::min())));
}
else
{
limit = std::numeric_limits<T>::max();
}
if (base != 0 && result > limit / base)
{
throw_or_mimic<exceptions::incorrect_argument_type>(text);
}
if (result * base > limit - digit)
{
throw_or_mimic<exceptions::incorrect_argument_type>(text);
}
result = next;
result = static_cast<US>(result * base + digit);
}
detail::check_signed_range<T>(negative, result, text);
@ -1035,25 +1062,6 @@ parse_value(const std::string& text, T& value) {
stringstream_parser(text, value);
}
template <typename T>
void
parse_value(const std::string& text, std::vector<T>& value)
{
if (text.empty()) {
T v;
parse_value(text, v);
value.emplace_back(std::move(v));
return;
}
std::stringstream in(text);
std::string token;
while(!in.eof() && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
T v;
parse_value(token, v);
value.emplace_back(std::move(v));
}
}
#ifdef CXXOPTS_HAS_OPTIONAL
template <typename T>
void
@ -1076,6 +1084,41 @@ void parse_value(const std::string& text, char& c)
c = text[0];
}
template <typename T>
void
parse_value(const std::string& text, std::vector<T>& value)
{
if (text.empty()) {
T v;
parse_value(text, v);
value.emplace_back(std::move(v));
return;
}
std::stringstream in(text);
std::string token;
while(!in.eof() && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
T v;
parse_value(token, v);
value.emplace_back(std::move(v));
}
}
template <typename T>
void
add_value(const std::string& text, T& value)
{
parse_value(text, value);
}
template <typename T>
void
add_value(const std::string& text, std::vector<T>& value)
{
T v;
add_value(text, v);
value.emplace_back(std::move(v));
}
template <typename T>
struct type_is_container
{
@ -1127,6 +1170,12 @@ class abstract_value : public Value
m_implicit_value = rhs.m_implicit_value;
}
void
add(const std::string& text) const override
{
add_value(text, *m_store);
}
void
parse(const std::string& text) const override
{
@ -1412,6 +1461,19 @@ struct HelpGroupDetails
class OptionValue
{
public:
void
add
(
const std::shared_ptr<const OptionDetails>& details,
const std::string& text
)
{
ensure_value(details);
++m_count;
m_value->add(text);
m_long_names = &details->long_names();
}
void
parse
(
@ -1498,7 +1560,7 @@ CXXOPTS_DIAGNOSTIC_POP
class KeyValue
{
public:
KeyValue(std::string key_, std::string value_)
KeyValue(std::string key_, std::string value_) noexcept
: m_key(std::move(key_))
, m_value(std::move(value_))
{
@ -1782,7 +1844,7 @@ class OptionParser
);
void
add_to_option(OptionMap::const_iterator iter, const std::string& option, const std::string& arg);
add_to_option(const std::shared_ptr<OptionDetails>& value, const std::string& arg);
void
parse_option
@ -1985,6 +2047,7 @@ class Options
std::unordered_set<std::string> m_positional_set{};
//mapping from groups to help options
std::vector<std::string> m_group{};
std::map<std::string, HelpGroupDetails> m_help{};
};
@ -2237,6 +2300,7 @@ OptionAdder::operator()
case 1:
short_name = *first_short_name_iter;
option_names.erase(first_short_name_iter);
CXXOPTS_FALLTHROUGH;
case 0:
break;
default:
@ -2328,9 +2392,13 @@ OptionParser::checked_parse_arg
inline
void
OptionParser::add_to_option(OptionMap::const_iterator iter, const std::string& option, const std::string& arg)
OptionParser::add_to_option(const std::shared_ptr<OptionDetails>& value, const std::string& arg)
{
parse_option(iter->second, option, arg);
auto hash = value->hash();
auto& result = m_parsed[hash];
result.add(value, arg);
m_sequential.emplace_back(value->essential_name(), arg);
}
inline
@ -2347,14 +2415,14 @@ OptionParser::consume_positional(const std::string& a, PositionalListIterator& n
auto& result = m_parsed[iter->second->hash()];
if (result.count() == 0)
{
add_to_option(iter, *next, a);
add_to_option(iter->second, a);
++next;
return true;
}
++next;
continue;
}
add_to_option(iter, *next, a);
add_to_option(iter->second, a);
return true;
}
throw_or_mimic<exceptions::no_such_option>(*next);
@ -2618,6 +2686,12 @@ Options::add_option
}
//add the help details
if (m_help.find(group) == m_help.end())
{
m_group.push_back(group);
}
auto& options = m_help[group];
options.options.emplace_back(HelpOptionDetails{s, l, stringDesc,
@ -2749,19 +2823,7 @@ inline
void
Options::generate_all_groups_help(String& result) const
{
std::vector<std::string> all_groups;
std::transform(
m_help.begin(),
m_help.end(),
std::back_inserter(all_groups),
[] (const std::map<std::string, HelpGroupDetails>::value_type& group)
{
return group.first;
}
);
generate_group_help(result, all_groups);
generate_group_help(result, m_group);
}
inline
@ -2801,19 +2863,7 @@ inline
std::vector<std::string>
Options::groups() const
{
std::vector<std::string> g;
std::transform(
m_help.begin(),
m_help.end(),
std::back_inserter(g),
[] (const std::map<std::string, HelpGroupDetails>::value_type& pair)
{
return pair.first;
}
);
return g;
return m_group;
}
inline

View file

@ -12,7 +12,7 @@ inline namespace STEINWURF_CPUID_VERSION
{
std::string version()
{
return "8.0.0";
return "9.0.0";
}
}
}

View file

@ -11,7 +11,7 @@ namespace cpuid
{
/// Here we define the STEINWURF_CPUID_VERSION this should be updated on each
/// release
#define STEINWURF_CPUID_VERSION v8_0_0
#define STEINWURF_CPUID_VERSION v9_0_0
inline namespace STEINWURF_CPUID_VERSION
{

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2006-2022 Arseny Kapoulkine
Copyright (c) 2006-2024 Arseny Kapoulkine
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View file

@ -1,7 +1,7 @@
/**
* pugixml parser - version 1.13
* pugixml parser - version 1.14
* --------------------------------------------------------
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Copyright (C) 2006-2024, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
@ -52,7 +52,7 @@
#endif
/**
* Copyright (c) 2006-2022 Arseny Kapoulkine
* Copyright (c) 2006-2024 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/**
* pugixml parser - version 1.13
* pugixml parser - version 1.14
* --------------------------------------------------------
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Copyright (C) 2006-2024, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
@ -14,7 +14,7 @@
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
#ifndef PUGIXML_VERSION
# define PUGIXML_VERSION 1130 // 1.13
# define PUGIXML_VERSION 1140 // 1.14
#endif
// Include user configuration file (this can define various configuration macros)
@ -138,7 +138,7 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
typedef std::basic_string<PUGIXML_CHAR> string_t;
#endif
}
@ -213,6 +213,10 @@ namespace pugi
// This flag is off by default.
const unsigned int parse_embed_pcdata = 0x2000;
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
// This flag is off by default.
const unsigned int parse_merge_pcdata = 0x4000;
// The default parsing mode.
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
@ -324,7 +328,7 @@ namespace pugi
class PUGIXML_CLASS xml_writer
{
public:
virtual ~xml_writer() {}
virtual ~xml_writer();
// Write memory chunk into stream/file/whatever
virtual void write(const void* data, size_t size) = 0;
@ -349,14 +353,14 @@ namespace pugi
{
public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
xml_writer_stream(std::basic_ostream<char>& stream);
xml_writer_stream(std::basic_ostream<wchar_t>& stream);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
private:
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
std::basic_ostream<char>* narrow_stream;
std::basic_ostream<wchar_t>* wide_stream;
};
#endif
@ -418,8 +422,9 @@ namespace pugi
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
bool set_name(const char_t* rhs);
bool set_value(const char_t* rhs, size_t sz);
bool set_name(const char_t* rhs, size_t size);
bool set_value(const char_t* rhs);
bool set_value(const char_t* rhs, size_t size);
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set_value(int rhs);
@ -553,8 +558,9 @@ namespace pugi
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
bool set_name(const char_t* rhs);
bool set_value(const char_t* rhs, size_t sz);
bool set_name(const char_t* rhs, size_t size);
bool set_value(const char_t* rhs);
bool set_value(const char_t* rhs, size_t size);
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
xml_attribute append_attribute(const char_t* name);
@ -694,8 +700,8 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Print subtree to stream
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
#endif
// Child nodes iterators
@ -712,9 +718,12 @@ namespace pugi
// Range-based for support
xml_object_range<xml_node_iterator> children() const;
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
xml_object_range<xml_attribute_iterator> attributes() const;
// Range-based for support for all children with the specified name
// Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
// Get node offset in parsed file/string (in char_t units) for debugging purposes
ptrdiff_t offset_debug() const;
@ -779,8 +788,8 @@ namespace pugi
bool as_bool(bool def = false) const;
// Set text (returns false if object is empty or there is not enough memory)
bool set(const char_t* rhs, size_t sz);
bool set(const char_t* rhs);
bool set(const char_t* rhs, size_t size);
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set(int rhs);
@ -927,6 +936,7 @@ namespace pugi
xml_named_node_iterator();
// Construct an iterator which points to the specified node
// Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
xml_named_node_iterator(const xml_node& node, const char_t* name);
// Iterator operators
@ -1062,8 +1072,8 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Load document from stream.
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
#endif
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
@ -1092,8 +1102,8 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
#endif
// Save XML to file
@ -1429,12 +1439,12 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Convert wide string to UTF8
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
// Convert UTF8 to wide string
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
#endif
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
@ -1481,7 +1491,7 @@ namespace std
#endif
/**
* Copyright (c) 2006-2022 Arseny Kapoulkine
* Copyright (c) 2006-2024 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation