From fda6414443d25e3c8d90043669744a47ce29fe45 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 19 Dec 2013 08:09:13 +0400 Subject: [PATCH 01/26] Don't use vector<>::data. This is only required by C++ 11. Most compilers have it anyway, but there are exceptions, like msvc 8 and msvc 9. --- test/exception_txt_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/exception_txt_test.cpp b/test/exception_txt_test.cpp index d37973a..bbc6003 100644 --- a/test/exception_txt_test.cpp +++ b/test/exception_txt_test.cpp @@ -59,7 +59,7 @@ void test_each_exception_message(const string& test_description, const vector Date: Thu, 19 Dec 2013 08:16:19 +0400 Subject: [PATCH 02/26] Add dllexport to common_config_file_iterator. As reported in #6797, there are linker errors otherwise. I do not know why regression tests, which test dll linking explicitly, do not catch this. --- include/boost/program_options/detail/config_file.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/program_options/detail/config_file.hpp b/include/boost/program_options/detail/config_file.hpp index 4c2c15b..b819b5d 100644 --- a/include/boost/program_options/detail/config_file.hpp +++ b/include/boost/program_options/detail/config_file.hpp @@ -62,7 +62,7 @@ namespace boost { namespace program_options { namespace detail { TODO: maybe, we should just accept a pointer to options_description class. */ - class common_config_file_iterator + class BOOST_PROGRAM_OPTIONS_DECL common_config_file_iterator : public eof_iterator { public: From 2acfab15a3a1516ac8295036c83b673879a0a4a4 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Wed, 8 Jan 2014 17:07:45 +0100 Subject: [PATCH 03/26] Fix config_file compilation errors with MSVC Previous fix 4ae33c for ticket #6797 introduced a new problem with Visual Studio compilers about two missing methods in 'common_config_file_iterator'. Adding those seemingly not required methods as empty methods fixes the issue. As an added bonus, the bogus warnings about DLL-interfaces get a silencing treatment, too. Tests were run with vc10, vc11, and vc12. Without this fix, the affected test cases fail on all 3 compilers. With the fix in place, all tests pass. Signed-off-by: Daniela Engert --- .../boost/program_options/detail/config_file.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/boost/program_options/detail/config_file.hpp b/include/boost/program_options/detail/config_file.hpp index b819b5d..9d35f9e 100644 --- a/include/boost/program_options/detail/config_file.hpp +++ b/include/boost/program_options/detail/config_file.hpp @@ -27,6 +27,11 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4251) // class XYZ needs to have dll-interface to be used by clients of class XYZ +#endif + namespace boost { namespace program_options { namespace detail { @@ -77,6 +82,11 @@ namespace boost { namespace program_options { namespace detail { void get(); +#if BOOST_WORKAROUND(_MSC_VER, <= 1800) + void decrement() {} + void advance(difference_type) {} +#endif + protected: // Stubs for derived classes // Obtains next line from the config file @@ -177,4 +187,8 @@ namespace boost { namespace program_options { namespace detail { }}} +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + #endif From 3ce1c74a0f0257d291c47e28bd2bae8385b69225 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Wed, 8 Jan 2014 20:00:47 +0100 Subject: [PATCH 04/26] Suppress msvc level-4 warnings. Even when compiled at warning level 4 (i.e. all), project policies may require compilations without warnings issued. Signed-off-by: Daniela Engert --- include/boost/program_options/options_description.hpp | 5 +++++ src/parsers.cpp | 2 +- src/value_semantic.cpp | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/boost/program_options/options_description.hpp b/include/boost/program_options/options_description.hpp index 32f6990..04e42a8 100644 --- a/include/boost/program_options/options_description.hpp +++ b/include/boost/program_options/options_description.hpp @@ -236,6 +236,11 @@ namespace program_options { void print(std::ostream& os, unsigned width = 0) const; private: +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800)) + // prevent warning C4512: assignment operator could not be generated + options_description& operator=(const options_description&); +#endif + typedef std::map::const_iterator name2index_iterator; typedef std::pair approximation_range; diff --git a/src/parsers.cpp b/src/parsers.cpp index 2361a48..dd62c66 100644 --- a/src/parsers.cpp +++ b/src/parsers.cpp @@ -220,7 +220,7 @@ namespace boost { namespace program_options { { // Intel-Win-7.1 does not understand // push_back on string. - result += tolower(s[n]); + result += static_cast(tolower(s[n])); } } return result; diff --git a/src/value_semantic.cpp b/src/value_semantic.cpp index 5314029..5818b07 100644 --- a/src/value_semantic.cpp +++ b/src/value_semantic.cpp @@ -268,7 +268,12 @@ namespace boost { namespace program_options { void error_with_option_name::replace_token(const string& from, const string& to) const { +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800)) +// prevent warning C4127: conditional expression is constant + for (;;) +#else while (1) +#endif { std::size_t pos = m_message.find(from.c_str(), 0, from.length()); // not found: all replaced From f50b02750a7b17ec6a149c0264bef5727a8df1f6 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 20 Jan 2014 09:28:12 +0400 Subject: [PATCH 05/26] Don't increment environment pointer past the end. This should not effect correct programs, since once the iterator itself is past-the-end, it should not matter what the underlying state of that iterator is. But, the new behaviour is more obvious. --- include/boost/program_options/environment_iterator.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/program_options/environment_iterator.hpp b/include/boost/program_options/environment_iterator.hpp index c815693..933919d 100644 --- a/include/boost/program_options/environment_iterator.hpp +++ b/include/boost/program_options/environment_iterator.hpp @@ -40,8 +40,9 @@ namespace boost { assert(n != s.npos); value().first = s.substr(0, n); value().second = s.substr(n+1); - } - ++m_environment; + + ++m_environment; + } } private: From 37804b54d4ecbeaea770e4f4fce46cc371083c81 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 9 Apr 2014 14:04:48 +0400 Subject: [PATCH 06/26] Remove unnecessary workaround. Closes #9854. --- src/value_semantic.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/value_semantic.cpp b/src/value_semantic.cpp index 5818b07..a7366d4 100644 --- a/src/value_semantic.cpp +++ b/src/value_semantic.cpp @@ -268,12 +268,7 @@ namespace boost { namespace program_options { void error_with_option_name::replace_token(const string& from, const string& to) const { -#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800)) -// prevent warning C4127: conditional expression is constant for (;;) -#else - while (1) -#endif { std::size_t pos = m_message.find(from.c_str(), 0, from.length()); // not found: all replaced From f081a9364353b8c40f84fd058312c81d3c9539f8 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 18 Aug 2014 15:09:12 +0100 Subject: [PATCH 07/26] Add metadata file. --- meta/libraries.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 meta/libraries.json diff --git a/meta/libraries.json b/meta/libraries.json new file mode 100644 index 0000000..5fbf312 --- /dev/null +++ b/meta/libraries.json @@ -0,0 +1,15 @@ +{ + "key": "program_options", + "name": "Program Options", + "authors": [ + "Vladimir Prus" + ], + "description": "The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file.", + "category": [ + "IO", + "Miscellaneous" + ], + "maintainers": [ + "Vladimir Prus " + ] +} From 6e846597d5e3d5de8efda897880e0b92c2602778 Mon Sep 17 00:00:00 2001 From: Hans Hohenfeld Date: Fri, 31 Oct 2014 17:59:20 +0100 Subject: [PATCH 08/26] Use maximum unsigned as default multitoken limit. Fixes #10718. --- include/boost/program_options/value_semantic.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/program_options/value_semantic.hpp b/include/boost/program_options/value_semantic.hpp index 081e997..57bb2ac 100644 --- a/include/boost/program_options/value_semantic.hpp +++ b/include/boost/program_options/value_semantic.hpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace boost { namespace program_options { @@ -313,7 +314,7 @@ namespace boost { namespace program_options { unsigned max_tokens() const { if (m_multitoken) { - return 32000; + return std::numeric_limits::max(); } else if (m_zero_tokens) { return 0; } else { From 1a17f20532be3480f01d11a1c692008024136597 Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Thu, 3 Jul 2014 21:32:27 +0200 Subject: [PATCH 09/26] Compile fix for MSVC 14 Also fixes some new variable shadowing warnings in cmdline_test with Visual C++ 14. --- include/boost/program_options/detail/config_file.hpp | 2 +- test/cmdline_test.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/program_options/detail/config_file.hpp b/include/boost/program_options/detail/config_file.hpp index 9d35f9e..be6bba1 100644 --- a/include/boost/program_options/detail/config_file.hpp +++ b/include/boost/program_options/detail/config_file.hpp @@ -82,7 +82,7 @@ namespace boost { namespace program_options { namespace detail { void get(); -#if BOOST_WORKAROUND(_MSC_VER, <= 1800) +#if BOOST_WORKAROUND(_MSC_VER, <= 1900) void decrement() {} void advance(difference_type) {} #endif diff --git a/test/cmdline_test.cpp b/test/cmdline_test.cpp index ed86160..23c15e4 100644 --- a/test/cmdline_test.cpp +++ b/test/cmdline_test.cpp @@ -126,9 +126,9 @@ void test_cmdline(const char* syntax, try { vector