From 98b31d788b827763f7ec97db5a9db4e4dd9f0deb Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Mon, 18 Jun 2018 13:10:22 +0200 Subject: [PATCH] Adding tests and deprecation messages --- CMakeLists.txt | 2 +- include/CLI/App.hpp | 12 +++++++++++ include/CLI/Macros.hpp | 2 +- include/CLI/Option.hpp | 4 ++++ tests/CMakeLists.txt | 8 ++++++++ tests/DeprecatedTest.cpp | 43 ++++++++++++++++++++++++++++++++++++++++ tests/HelpTest.cpp | 8 ++++++++ 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 tests/DeprecatedTest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fe82483..e8cce1b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) if(MSVC) add_definitions("/W4") else() - add_definitions(-Wall -Wextra -pedantic -Wno-deprecated-declarations) + add_definitions(-Wall -Wextra -pedantic) endif() if(CMAKE_VERSION VERSION_GREATER 3.6) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index d81ccfd6..58ab5fd3 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -1039,6 +1039,18 @@ class App { return formatter_->make_help(this, prev, mode); } + /// Provided for backwards compatibility \deprecated + CLI11_DEPRECATED("Please use footer instead") + App *set_footer(std::string msg) { return footer(msg); } + + /// Provided for backwards compatibility \deprecated + CLI11_DEPRECATED("Please use name instead") + App *set_name(std::string msg) { return name(msg); } + + /// Provided for backwards compatibility \deprecated + CLI11_DEPRECATED("Please use callback instead") + App *set_callback(std::function fn) { return callback(fn); } + ///@} /// @name Getters ///@{ diff --git a/include/CLI/Macros.hpp b/include/CLI/Macros.hpp index 6defe59a..f7a26650 100644 --- a/include/CLI/Macros.hpp +++ b/include/CLI/Macros.hpp @@ -30,7 +30,7 @@ #endif #endif -#if defined(PYBIND11_CPP14) +#if defined(CLI11_CPP14) #define CLI11_DEPRECATED(reason) [[deprecated(reason)]] #elif defined(_MSC_VER) #define CLI11_DEPRECATED(reason) __declspec(deprecated(reason)) diff --git a/include/CLI/Option.hpp b/include/CLI/Option.hpp index d0335ff9..3bb24340 100644 --- a/include/CLI/Option.hpp +++ b/include/CLI/Option.hpp @@ -665,6 +665,10 @@ class Option : public OptionBase