mirror of
https://github.com/boostorg/program_options.git
synced 2026-01-20 16:52:14 +00:00
Compare commits
2 Commits
boost-1.87
...
feature/gh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f233f00be | ||
|
|
fafcca13d8 |
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
@@ -116,24 +116,33 @@ jobs:
|
||||
- toolset: clang
|
||||
compiler: clang++-13
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
container: ubuntu:22.04
|
||||
os: ubuntu-latest
|
||||
install: clang-13
|
||||
- toolset: clang
|
||||
compiler: clang++-14
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
container: ubuntu:22.04
|
||||
os: ubuntu-latest
|
||||
install: clang-14
|
||||
- toolset: clang
|
||||
compiler: clang++-15
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
container: ubuntu:22.04
|
||||
os: ubuntu-latest
|
||||
install: clang-15
|
||||
- toolset: clang
|
||||
compiler: clang++-16
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
os: ubuntu-latest
|
||||
install: clang-16
|
||||
- toolset: clang
|
||||
compiler: clang++-17
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
container: ubuntu:23.10
|
||||
os: ubuntu-latest
|
||||
install: clang-17
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: macos-11
|
||||
@@ -227,7 +236,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
@@ -271,7 +280,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
@@ -319,7 +328,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
@@ -377,7 +386,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
@@ -430,7 +439,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
@@ -479,7 +488,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
@@ -546,7 +555,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
# include <optional>
|
||||
#endif
|
||||
|
||||
// forward declaration
|
||||
namespace boost { template<class T> class optional; }
|
||||
|
||||
@@ -169,6 +173,22 @@ namespace boost { namespace program_options {
|
||||
v = boost::any(boost::optional<T>(boost::any_cast<T>(a)));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
/** Validates std::optional arguments. */
|
||||
template<class T, class charT>
|
||||
void validate(boost::any& v,
|
||||
const std::vector<std::basic_string<charT> >& s,
|
||||
std::optional<T>*,
|
||||
int)
|
||||
{
|
||||
validators::check_first_occurrence(v);
|
||||
validators::get_single_string(s);
|
||||
boost::any a;
|
||||
validate(a, s, (T*)0, 0);
|
||||
v = boost::any(std::optional<T>(boost::any_cast<T>(a)));
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T, class charT>
|
||||
void
|
||||
typed_value<T, charT>::
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace boost { namespace program_options {
|
||||
/** gcc says that throw specification on dtor is loosened
|
||||
* without this line
|
||||
* */
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_option_name() throw(), {})
|
||||
|
||||
|
||||
//void dump() const
|
||||
@@ -183,7 +183,7 @@ namespace boost { namespace program_options {
|
||||
|
||||
/** Creates the error_message on the fly
|
||||
* Currently a thin wrapper for substitute_placeholders() */
|
||||
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW;
|
||||
virtual const char* what() const throw();
|
||||
|
||||
protected:
|
||||
/** Used to hold the error text returned by what() */
|
||||
@@ -209,7 +209,7 @@ namespace boost { namespace program_options {
|
||||
multiple_values()
|
||||
: error_with_option_name("option '%canonical_option%' only takes a single argument"){}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_values() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_values() throw(), {})
|
||||
};
|
||||
|
||||
/** Class thrown when there are several occurrences of an
|
||||
@@ -220,7 +220,7 @@ namespace boost { namespace program_options {
|
||||
multiple_occurrences()
|
||||
: error_with_option_name("option '%canonical_option%' cannot be specified more than once"){}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_occurrences() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_occurrences() throw(), {})
|
||||
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~required_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~required_option() throw(), {})
|
||||
};
|
||||
|
||||
/** Base class of unparsable options,
|
||||
@@ -258,7 +258,7 @@ namespace boost { namespace program_options {
|
||||
/** Does NOT set option name, because no option name makes sense */
|
||||
virtual void set_option_name(const std::string&) {}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() throw(), {})
|
||||
};
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~unknown_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~unknown_option() throw(), {})
|
||||
};
|
||||
|
||||
|
||||
@@ -283,9 +283,9 @@ namespace boost { namespace program_options {
|
||||
m_alternatives(xalternatives)
|
||||
{}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~ambiguous_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~ambiguous_option() throw(), {})
|
||||
|
||||
const std::vector<std::string>& alternatives() const BOOST_NOEXCEPT_OR_NOTHROW {return m_alternatives;}
|
||||
const std::vector<std::string>& alternatives() const throw() {return m_alternatives;}
|
||||
|
||||
protected:
|
||||
/** Makes all substitutions using the template */
|
||||
@@ -320,7 +320,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_syntax() throw(), {})
|
||||
|
||||
kind_t kind() const {return m_kind;}
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace boost { namespace program_options {
|
||||
m_substitutions["invalid_line"] = invalid_line;
|
||||
}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() throw(), {})
|
||||
|
||||
/** Convenience functions for backwards compatibility */
|
||||
virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
|
||||
@@ -355,7 +355,7 @@ namespace boost { namespace program_options {
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0):
|
||||
invalid_syntax(kind, option_name, original_token, option_style) {}
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_command_line_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_command_line_syntax() throw(), {})
|
||||
};
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(~validation_error() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
BOOST_DEFAULTED_FUNCTION(~validation_error() throw(), {})
|
||||
|
||||
kind_t kind() const { return m_kind; }
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace boost { namespace program_options {
|
||||
}
|
||||
|
||||
|
||||
const char* error_with_option_name::what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
const char* error_with_option_name::what() const throw()
|
||||
{
|
||||
// will substitute tokens each time what is run()
|
||||
substitute_placeholders(m_error_template);
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace po = boost::program_options;
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
# include <optional>
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#include "minitest.hpp"
|
||||
@@ -19,9 +22,10 @@ std::vector<std::string> sv(const char* array[], unsigned size)
|
||||
return r;
|
||||
}
|
||||
|
||||
template<template<typename> class OptionalType>
|
||||
void test_optional()
|
||||
{
|
||||
boost::optional<int> foo, bar, baz;
|
||||
OptionalType<int> foo, bar, baz;
|
||||
|
||||
po::options_description desc;
|
||||
desc.add_options()
|
||||
@@ -48,6 +52,9 @@ void test_optional()
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
test_optional();
|
||||
test_optional<boost::optional>();
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
test_optional<std::optional>();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user