Add C++14 standard [[deprecated]] attribute
authorTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>
Sat, 19 Nov 2016 13:08:48 +0000 (22:08 +0900)
committerTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>
Sat, 19 Nov 2016 13:08:48 +0000 (22:08 +0900)
See also
For __cplusplus predefined macro, https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
For [[deprecated]] attribute, https://isocpp.org/wiki/faq/cpp14-language#deprecated-attribute

lib/lz4.h

index 49854e4..7420ad8 100644 (file)
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -413,7 +413,9 @@ union LZ4_streamDecode_u {
 #  define LZ4_DEPRECATED(message)   /* disable deprecation warnings */
 #else
 #  define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#  if (LZ4_GCC_VERSION >= 405) || defined(__clang__)
+#  if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
+#    define LZ4_DEPRECATED(message) [[deprecated(message)]]
+#  elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
 #    define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
 #  elif (LZ4_GCC_VERSION >= 301)
 #    define LZ4_DEPRECATED(message) __attribute__((deprecated))