This is an automated email from the ASF dual-hosted git repository.
phrocker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new fdb46dd MINIFICPP-817 - Update cxxopts version to 2.1.2
fdb46dd is described below
commit fdb46dd72ecbf596eb4588714304566151096b68
Author: Daniel Bakai <[email protected]>
AuthorDate: Wed Apr 24 11:20:04 2019 +0200
MINIFICPP-817 - Update cxxopts version to 2.1.2
This closes #544.
Signed-off-by: Marc Parisi <[email protected]>
---
thirdparty/cxxopts/CHANGELOG.md | 27 +++++++++++++++++++++++++--
thirdparty/cxxopts/CMakeLists.txt | 12 ++++++++++--
thirdparty/cxxopts/README.md | 17 ++++++++++++++++-
thirdparty/cxxopts/include/cxxopts.hpp | 31 ++++++++++++++++++++++++-------
thirdparty/cxxopts/src/example.cpp | 1 +
5 files changed, 76 insertions(+), 12 deletions(-)
diff --git a/thirdparty/cxxopts/CHANGELOG.md b/thirdparty/cxxopts/CHANGELOG.md
index 01b67b6..792c2e2 100644
--- a/thirdparty/cxxopts/CHANGELOG.md
+++ b/thirdparty/cxxopts/CHANGELOG.md
@@ -3,6 +3,19 @@
This is the changelog for `cxxopts`, a C++11 library for parsing command line
options. The project adheres to semantic versioning.
+## 2.1.2
+
+### Bug Fixes
+
+* Use `std::forward` instead of returning a copy in `toLocalString`.
+
+## 2.1.1
+
+### Bug Fixes
+
+* Revert the change adding `const` type for `argv`, because most users expect
+ to pass a non-const `argv` from `main`.
+
## 2.1
### Changed
@@ -12,12 +25,22 @@ options. The project adheres to semantic versioning.
when a positional argument could follow an option with an implicit value.
For example, `--foo value`, where `foo` has an implicit value, will be
parsed as `--foo=implicit` and a positional argument `value`.
-* Fixed an ambiguous overload in the `parse_positional` function when an
- `initializer_list` was directly passed.
+* Boolean values are no longer special, but are just an option with a default
+ and implicit value.
+
+### Added
+
+* Added support for `std::optional` as a storage type.
+* Allow the help string to be customised.
+* Use `const` for the type in the `argv` parameter, since the contents of the
+ arguments is never modified.
### Bug Fixes
* Building against GCC 4.9 was broken due to overly strict shadow warnings.
+* Fixed an ambiguous overload in the `parse_positional` function when an
+ `initializer_list` was directly passed.
+* Fixed precedence in the Boolean value regex.
## 2.0
diff --git a/thirdparty/cxxopts/CMakeLists.txt
b/thirdparty/cxxopts/CMakeLists.txt
index 192b529..892caa9 100644
--- a/thirdparty/cxxopts/CMakeLists.txt
+++ b/thirdparty/cxxopts/CMakeLists.txt
@@ -20,14 +20,22 @@
cmake_minimum_required(VERSION 3.1)
project(cxxopts)
+enable_testing()
-set(VERSION "1.2.0")
+set(VERSION "2.1.2")
option(CXXOPTS_BUILD_EXAMPLES "Set to ON to build examples" ON)
+option(CXXOPTS_BUILD_TESTS "Set to ON to build tests" OFF)
# request c++11 without gnu extension for the whole project and enable more
warnings
-set(CMAKE_CXX_STANDARD 11)
+if (CXXOPTS_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD ${CXXOPTS_CXX_STANDARD})
+else()
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
set(CMAKE_CXX_EXTENSIONS OFF)
+
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID
MATCHES "GNU")
diff --git a/thirdparty/cxxopts/README.md b/thirdparty/cxxopts/README.md
index c5c171b..e575e61 100644
--- a/thirdparty/cxxopts/README.md
+++ b/thirdparty/cxxopts/README.md
@@ -1,5 +1,10 @@
[](https://travis-ci.org/jarro2783/cxxopts)
+# Release versions
+
+Note that `master` is generally a work in progress, and you probably want to
use a
+tagged release version.
+
# Quick start
This is a lightweight C++ option parser library, supporting the standard GNU
@@ -52,6 +57,17 @@ exception will be thrown.
Note that the result of `options.parse` should only be used as long as the
`options` object that created it is in scope.
+## Exceptions
+
+Exceptional situations throw C++ exceptions. There are two types of
+exceptions: errors defining the options, and errors when parsing a list of
+arguments. All exceptions derive from `cxxopts::OptionException`. Errors
+defining options derive from `cxxopts::OptionSpecException` and errors
+parsing arguments derive from `cxxopts::OptionParseException`.
+
+All exceptions define a `what()` function to get a printable string
+explaining the error.
+
## Help groups
Options can be placed into groups for the purposes of displaying help messages.
@@ -116,4 +132,3 @@ expressions. For example GCC >= 4.9 or clang with libc++.
# TODO list
* Allow unrecognised options.
-* Various help strings.
diff --git a/thirdparty/cxxopts/include/cxxopts.hpp
b/thirdparty/cxxopts/include/cxxopts.hpp
index 6a6a85f..e87416f 100644
--- a/thirdparty/cxxopts/include/cxxopts.hpp
+++ b/thirdparty/cxxopts/include/cxxopts.hpp
@@ -38,11 +38,16 @@ THE SOFTWARE.
#include <unordered_set>
#include <vector>
+#ifdef __cpp_lib_optional
+#include <optional>
+#define CXXOPTS_HAS_OPTIONAL
+#endif
+
namespace cxxopts
{
static constexpr struct {
uint8_t major, minor, patch;
- } version = {2, 1, 0};
+ } version = {2, 1, 2};
}
//when we ask cxxopts to use Unicode, help strings are processed using ICU,
@@ -197,7 +202,7 @@ namespace cxxopts
T
toLocalString(T&& t)
{
- return t;
+ return std::forward<T>(t);
}
inline
@@ -697,6 +702,17 @@ namespace cxxopts
value.push_back(v);
}
+#ifdef CXXOPTS_HAS_OPTIONAL
+ template <typename T>
+ void
+ parse_value(const std::string& text, std::optional<T>& value)
+ {
+ T result;
+ parse_value(text, result);
+ value = std::move(result);
+ }
+#endif
+
template <typename T>
struct type_is_container
{
@@ -855,13 +871,13 @@ namespace cxxopts
standard_value()
{
- set_implicit();
+ set_default_and_implicit();
}
standard_value(bool* b)
: abstract_value(b)
{
- set_implicit();
+ set_default_and_implicit();
}
std::shared_ptr<Value>
@@ -873,8 +889,10 @@ namespace cxxopts
private:
void
- set_implicit()
+ set_default_and_implicit()
{
+ m_default = true;
+ m_default_value = "false";
m_implicit = true;
m_implicit_value = "true";
}
@@ -1001,7 +1019,6 @@ namespace cxxopts
{
ensure_value(details);
m_value->parse();
- m_count++;
}
size_t
@@ -1355,7 +1372,7 @@ namespace cxxopts
{
auto desc = o.desc;
- if (o.has_default)
+ if (o.has_default && (!o.is_boolean || o.default_value != "false"))
{
desc += toLocalString(" (default: " + o.default_value + ")");
}
diff --git a/thirdparty/cxxopts/src/example.cpp
b/thirdparty/cxxopts/src/example.cpp
index b541774..64709f2 100644
--- a/thirdparty/cxxopts/src/example.cpp
+++ b/thirdparty/cxxopts/src/example.cpp
@@ -40,6 +40,7 @@ int main(int argc, char* argv[])
options.add_options()
("a,apple", "an apple", cxxopts::value<bool>(apple))
("b,bob", "Bob")
+ ("t,true", "True", cxxopts::value<bool>()->default_value("true"))
("f, file", "File", cxxopts::value<std::vector<std::string>>(), "FILE")
("i,input", "Input", cxxopts::value<std::string>())
("o,output", "Output file", cxxopts::value<std::string>()