From 2d608d773f3494e84cb154bdbb07954e87d9af86 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 3 Jun 2019 14:31:03 +0300 Subject: [PATCH] Annotate deprecated functions as such --- source/core/attributes.h | 12 ++++++++++++ source/core/getopt.h | 5 +++-- source/fs/dir.h | 9 +++++---- source/time/timer.h | 3 ++- source/time/units.h | 1 + 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 source/core/attributes.h diff --git a/source/core/attributes.h b/source/core/attributes.h new file mode 100644 index 0000000..6531698 --- /dev/null +++ b/source/core/attributes.h @@ -0,0 +1,12 @@ +#ifndef MSP_CORE_ATTRIBUTES_H_ +#define MSP_CORE_ATTRIBUTES_H_ + +#if __cplusplus >= 201402L +#define DEPRECATED [[deprecated]] +#elif defined(__GNUC__) +#define DEPRECATED __attribute__((deprecated)) +#elif defined(__MSC_VER) +#define DEPRECATED __declspec(deprecated) +#endif + +#endif diff --git a/source/core/getopt.h b/source/core/getopt.h index e60a226..64a946c 100644 --- a/source/core/getopt.h +++ b/source/core/getopt.h @@ -6,6 +6,7 @@ #include #include #include +#include "attributes.h" #include "noncopyable.h" namespace Msp { @@ -216,8 +217,8 @@ public: ~GetOpt(); /** Returns any non-option arguments encountered during processing. - Deprecated. */ - const std::vector &get_args() const { return args_raw; } + Deprecated; use add_argument instead. */ + DEPRECATED const std::vector &get_args() const { return args_raw; } /** Adds an option with both short and long forms. Processing depends on the type of the destination variable and whether an argument is taken or diff --git a/source/fs/dir.h b/source/fs/dir.h index e964a2d..89d86ed 100644 --- a/source/fs/dir.h +++ b/source/fs/dir.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "path.h" namespace Msp { @@ -44,25 +45,25 @@ void chdir(const Path &); Path get_home_dir(); /// Deprecated. Use the argument-less version instead. -Path get_user_data_dir(const std::string &appname); +DEPRECATED Path get_user_data_dir(const std::string &appname); /// Returns a directory suitable for storing user-specific data. Path get_user_data_dir(); /// Deprecated. Use the argument-less version instead. -Path get_sys_conf_dir(const std::string &argv0); +DEPRECATED Path get_sys_conf_dir(const std::string &argv0); /// Returns a directory containing system-wide configuration. Path get_sys_conf_dir(); /// Deprecated. Use the argument-less version instead. -Path get_sys_data_dir(const std::string &argv0, const std::string &appname); +DEPRECATED Path get_sys_data_dir(const std::string &argv0, const std::string &appname); /// Returns a directory containing immutable system-wide data. Path get_sys_data_dir(); /// Deprecated. Use the argument-less version instead. -Path get_sys_lib_dir(const std::string &argv0, const std::string &appname); +DEPRECATED Path get_sys_lib_dir(const std::string &argv0, const std::string &appname); /// Returns a directory containing system-wide architecture-specific files. Path get_sys_lib_dir(); diff --git a/source/time/timer.h b/source/time/timer.h index 575599f..62f248d 100644 --- a/source/time/timer.h +++ b/source/time/timer.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -68,7 +69,7 @@ public: void cancel(Slot &); /** Deprecated. Use one of the other overloads. */ - void tick(bool block); + DEPRECATED void tick(bool block); /** Waits until a timer expires, then executes it. If no timers have been set, blocks until one is added from another thread. */ diff --git a/source/time/units.h b/source/time/units.h index ec06c11..abb61d8 100644 --- a/source/time/units.h +++ b/source/time/units.h @@ -4,5 +4,6 @@ #include "timedelta.h" // This header is deprecated +#error "Time units are in timedelta.h" #endif -- 2.43.0