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/plist/plist.h | |
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/plist/plist.h')
-rw-r--r-- | include/plist/plist.h | 40 |
1 files changed, 31 insertions, 9 deletions
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. |