diff options
author | Martin Szulecki | 2014-05-20 17:47:13 +0200 |
---|---|---|
committer | Martin Szulecki | 2014-05-20 17:47:13 +0200 |
commit | c51d1a77b04872020234af49384a4ebd22ddd5f0 (patch) | |
tree | 3af09391acc730f630c5df8705c4eafca7cd70df /include | |
parent | 993f65b3bda53e2b22ee9e94efd11cbddd7b73cb (diff) | |
download | libplist-c51d1a77b04872020234af49384a4ebd22ddd5f0.tar.gz libplist-c51d1a77b04872020234af49384a4ebd22ddd5f0.tar.bz2 |
Redo PLIST_WARN_DEPRECATED macro to work with older llvm/clang
Diffstat (limited to 'include')
-rw-r--r-- | include/plist/Dictionary.h | 2 | ||||
-rw-r--r-- | include/plist/plist.h | 40 |
2 files changed, 32 insertions, 10 deletions
diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h index eee14af..6ad505d 100644 --- a/include/plist/Dictionary.h +++ b/include/plist/Dictionary.h @@ -47,7 +47,7 @@ public : iterator End(); iterator Find(const std::string& key); iterator Set(const std::string& key, Node* node); - DEPRECATED("use Set() instead") iterator Insert(const std::string& key, Node* node); + PLIST_WARN_DEPRECATED("use Set() instead") iterator Insert(const std::string& key, Node* node); void Remove(Node* node); void Remove(const std::string& key); std::string GetNodeKey(Node* key); diff --git a/include/plist/plist.h b/include/plist/plist.h index b855043..f7df832 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h @@ -40,21 +40,43 @@ extern "C" typedef unsigned __int64 uint64_t; #ifdef plist_EXPORTS -#define PLIST_API __declspec( dllexport ) + #define PLIST_API __declspec( dllexport ) #else -#define PLIST_API __declspec( dllimport ) + #define PLIST_API __declspec( dllimport ) #endif -#define DEPRECATED(x) __declspec(deprecated(x)) + #else #include <stdint.h> #define PLIST_API -#ifdef __GNUC__ -#define DEPRECATED(x) __attribute__((deprecated(x))) +#endif + +#ifdef __llvm__ + #if defined(__has_extension) + #if (__has_extension(attribute_deprecated_with_message)) + #ifndef PLIST_WARN_DEPRECATED + #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated(x))) + #endif + #else + #ifndef PLIST_WARN_DEPRECATED + #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated)) + #endif + #endif + #else + #ifndef PLIST_WARN_DEPRECATED + #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated)) + #endif + #endif +#elif (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 5))) + #ifndef PLIST_WARN_DEPRECATED + #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated(x))) + #endif #elif defined(_MSC_VER) + #ifndef PLIST_WARN_DEPRECATED + #define PLIST_WARN_DEPRECATED(x) __declspec(deprecated(x)) + #endif #else -#define DEPRECATED(x) -#pragma message("WARNING: You need to implement DEPRECATED for this compiler") -#endif + #define PLIST_WARN_DEPRECATED(x) + #pragma message("WARNING: You need to implement DEPRECATED for this compiler") #endif #include <sys/types.h> @@ -339,7 +361,7 @@ extern "C" * @param item the new item to insert * @param key The identifier of the item to insert. */ - DEPRECATED("use plist_dict_set_item instead") PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item); + PLIST_WARN_DEPRECATED("use plist_dict_set_item instead") PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item); /** * Remove an existing position in a #PLIST_DICT node. |