]> git.tdb.fi Git - libs/core.git/commitdiff
Annotate deprecated functions as such
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:31:03 +0000 (14:31 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:31:03 +0000 (14:31 +0300)
source/core/attributes.h [new file with mode: 0644]
source/core/getopt.h
source/fs/dir.h
source/time/timer.h
source/time/units.h

diff --git a/source/core/attributes.h b/source/core/attributes.h
new file mode 100644 (file)
index 0000000..6531698
--- /dev/null
@@ -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
index e60a22693483ef4626a039e2ab4e0a33399c045e..64a946c80f1b4bd9ee35509c8f297fde0bdf6671 100644 (file)
@@ -6,6 +6,7 @@
 #include <string>
 #include <vector>
 #include <msp/strings/lexicalcast.h>
 #include <string>
 #include <vector>
 #include <msp/strings/lexicalcast.h>
+#include "attributes.h"
 #include "noncopyable.h"
 
 namespace Msp {
 #include "noncopyable.h"
 
 namespace Msp {
@@ -216,8 +217,8 @@ public:
        ~GetOpt();
 
        /** Returns any non-option arguments encountered during processing.
        ~GetOpt();
 
        /** Returns any non-option arguments encountered during processing.
-       Deprecated. */
-       const std::vector<std::string> &get_args() const { return args_raw; }
+       Deprecated; use add_argument instead. */
+       DEPRECATED const std::vector<std::string> &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
 
        /** 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
index e964a2d848ae93fd5875711544898608911a58f3..89d86ed9383c0f99661d80d1b169d82c87a2a585 100644 (file)
@@ -4,6 +4,7 @@
 #include <list>
 #include <stdexcept>
 #include <string>
 #include <list>
 #include <stdexcept>
 #include <string>
+#include <msp/core/attributes.h>
 #include "path.h"
 
 namespace Msp {
 #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_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.
 
 /// 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.
 
 /// 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.
 
 /// 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();
 
 /// Returns a directory containing system-wide architecture-specific files.
 Path get_sys_lib_dir();
index 575599fa6bb92eb16abeeced1f1147bb32cdaa8f..62f248d23a722078472c461b9f04186c6cdd827d 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <vector>
 #include <sigc++/sigc++.h>
 
 #include <vector>
 #include <sigc++/sigc++.h>
+#include <msp/core/attributes.h>
 #include <msp/core/mutex.h>
 #include <msp/core/noncopyable.h>
 #include <msp/core/semaphore.h>
 #include <msp/core/mutex.h>
 #include <msp/core/noncopyable.h>
 #include <msp/core/semaphore.h>
@@ -68,7 +69,7 @@ public:
        void cancel(Slot &);
 
        /** Deprecated.  Use one of the other overloads. */
        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. */
 
        /** Waits until a timer expires, then executes it.  If no timers have been
        set, blocks until one is added from another thread. */
index ec06c11523633d03cafc4d71d502aa09357f9e4a..abb61d8f81348b984db36b1eb7a4f77338344b1f 100644 (file)
@@ -4,5 +4,6 @@
 #include "timedelta.h"
 
 // This header is deprecated
 #include "timedelta.h"
 
 // This header is deprecated
+#error "Time units are in timedelta.h"
 
 #endif
 
 #endif