Commit c51d1a77 authored by Martin Szulecki's avatar Martin Szulecki

Redo PLIST_WARN_DEPRECATED macro to work with older llvm/clang

parent 993f65b3
...@@ -47,7 +47,7 @@ public : ...@@ -47,7 +47,7 @@ public :
iterator End(); iterator End();
iterator Find(const std::string& key); iterator Find(const std::string& key);
iterator Set(const std::string& key, Node* node); 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(Node* node);
void Remove(const std::string& key); void Remove(const std::string& key);
std::string GetNodeKey(Node* key); std::string GetNodeKey(Node* key);
......
...@@ -40,21 +40,43 @@ extern "C" ...@@ -40,21 +40,43 @@ extern "C"
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
#ifdef plist_EXPORTS #ifdef plist_EXPORTS
#define PLIST_API __declspec( dllexport ) #define PLIST_API __declspec( dllexport )
#else #else
#define PLIST_API __declspec( dllimport ) #define PLIST_API __declspec( dllimport )
#endif #endif
#define DEPRECATED(x) __declspec(deprecated(x))
#else #else
#include <stdint.h> #include <stdint.h>
#define PLIST_API #define PLIST_API
#ifdef __GNUC__ #endif
#define DEPRECATED(x) __attribute__((deprecated(x)))
#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) #elif defined(_MSC_VER)
#ifndef PLIST_WARN_DEPRECATED
#define PLIST_WARN_DEPRECATED(x) __declspec(deprecated(x))
#endif
#else #else
#define DEPRECATED(x) #define PLIST_WARN_DEPRECATED(x)
#pragma message("WARNING: You need to implement DEPRECATED for this compiler") #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#endif
#endif #endif
#include <sys/types.h> #include <sys/types.h>
...@@ -339,7 +361,7 @@ extern "C" ...@@ -339,7 +361,7 @@ extern "C"
* @param item the new item to insert * @param item the new item to insert
* @param key The identifier of the 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. * Remove an existing position in a #PLIST_DICT node.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment