Reimplement DEPRECATED macro with C++ attributes

And prefix it with NDN_CXX_ to avoid name clashes.

Change-Id: I18fd99bbc04a414cbee668936272769dbc4ea761
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
index 8b06194..f6c3bf4 100644
--- a/docs/doxygen.conf.in
+++ b/docs/doxygen.conf.in
@@ -2050,7 +2050,6 @@
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 PREDEFINED             = DOXYGEN \
-                         DEPRECATED(x)=x \
                          NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(x)= \
                          NDN_LOG_INIT(x)= \
                          PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
diff --git a/src/common.hpp b/src/common.hpp
index f9ceeb7..7b5d4c8 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -63,15 +63,6 @@
 #include <unistd.h>
 #include <utility>
 
-#if defined(__GNUC__) || defined(__clang__)
-#  define DEPRECATED(func) func __attribute__ ((deprecated))
-#elif defined(_MSC_VER)
-#  define DEPRECATED(func) __declspec(deprecated) func
-#else
-#  pragma message("DEPRECATED not implemented")
-#  define DEPRECATED(func) func
-#endif
-
 namespace ndn {
 
 using std::shared_ptr;
diff --git a/src/util/backports.hpp b/src/util/backports.hpp
index df1d775..1fd375e 100644
--- a/src/util/backports.hpp
+++ b/src/util/backports.hpp
@@ -40,7 +40,18 @@
 #  define NDN_CXX_HAS_INCLUDE(x) 0
 #endif
 
-#if NDN_CXX_HAS_CPP_ATTRIBUTE(fallthrough)
+#if (__cplusplus >= 201402L) && NDN_CXX_HAS_CPP_ATTRIBUTE(deprecated)
+#  define NDN_CXX_DEPRECATED_MSG(msg) [[deprecated(msg)]]
+#elif NDN_CXX_HAS_CPP_ATTRIBUTE(gnu::deprecated)
+#  define NDN_CXX_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]]
+#elif defined(__GNUC__)
+#  define NDN_CXX_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
+#else
+#  define NDN_CXX_DEPRECATED_MSG(msg)
+#endif
+#define NDN_CXX_DEPRECATED NDN_CXX_DEPRECATED_MSG("")
+
+#if (__cplusplus > 201402L) && NDN_CXX_HAS_CPP_ATTRIBUTE(fallthrough)
 #  define NDN_CXX_FALLTHROUGH [[fallthrough]]
 #elif NDN_CXX_HAS_CPP_ATTRIBUTE(clang::fallthrough)
 #  define NDN_CXX_FALLTHROUGH [[clang::fallthrough]]