diff options
author | Yann Collet <cyan@fb.com> | 2016-11-04 23:58:34 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2016-11-04 23:58:34 (GMT) |
commit | eaad740ac7267428b03ae19c7051e615ec507bda (patch) | |
tree | 22aed9edf9ea95735dc36f5f01ed8ea10c339b9d /lib/lz4frame.h | |
parent | 079d5dd54b763a0f1bf7aae14f7ff4852c358d8e (diff) | |
download | lz4-eaad740ac7267428b03ae19c7051e615ec507bda.zip lz4-eaad740ac7267428b03ae19c7051e615ec507bda.tar.gz lz4-eaad740ac7267428b03ae19c7051e615ec507bda.tar.bz2 |
lz4frame obsolete enum should trigger deprecation warnings (on supported compilers)
Diffstat (limited to 'lib/lz4frame.h')
-rw-r--r-- | lib/lz4frame.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 63abc60..08d1895 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -45,13 +45,11 @@ extern "C" { #endif -/*-************************************ -* Dependency -**************************************/ +/* --- Dependency --- */ #include <stddef.h> /* size_t */ /*-*************************************************************** -* Export parameters +* Compiler specifics *****************************************************************/ /*! * LZ4_DLL_EXPORT : @@ -67,6 +65,15 @@ extern "C" { # define LZ4FLIB_API #endif +#if defined(_MSC_VER) +# define LZ4F_DEPRECATE(x) __declspec(deprecated) x +#elif defined(__GNUC__) +# define LZ4F_DEPRECATE(x) x __attribute__((deprecated)) +#else +# define LZ4F_DEPRECATE(x) x /* no deprecation warning for this compiler */ +#endif + + /*-************************************ * Error management **************************************/ @@ -81,7 +88,7 @@ LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /* return er **************************************/ /* #define LZ4F_DISABLE_OBSOLETE_ENUMS */ /* uncomment to disable obsolete enums */ #ifndef LZ4F_DISABLE_OBSOLETE_ENUMS -# define LZ4F_OBSOLETE_ENUM(x) ,x +# define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x #else # define LZ4F_OBSOLETE_ENUM(x) #endif @@ -92,30 +99,30 @@ typedef enum { LZ4F_max256KB=5, LZ4F_max1MB=6, LZ4F_max4MB=7 - LZ4F_OBSOLETE_ENUM(max64KB = LZ4F_max64KB) - LZ4F_OBSOLETE_ENUM(max256KB = LZ4F_max256KB) - LZ4F_OBSOLETE_ENUM(max1MB = LZ4F_max1MB) - LZ4F_OBSOLETE_ENUM(max4MB = LZ4F_max4MB) + LZ4F_OBSOLETE_ENUM(max64KB) + LZ4F_OBSOLETE_ENUM(max256KB) + LZ4F_OBSOLETE_ENUM(max1MB) + LZ4F_OBSOLETE_ENUM(max4MB) } LZ4F_blockSizeID_t; typedef enum { LZ4F_blockLinked=0, LZ4F_blockIndependent - LZ4F_OBSOLETE_ENUM(blockLinked = LZ4F_blockLinked) - LZ4F_OBSOLETE_ENUM(blockIndependent = LZ4F_blockIndependent) + LZ4F_OBSOLETE_ENUM(blockLinked) + LZ4F_OBSOLETE_ENUM(blockIndependent) } LZ4F_blockMode_t; typedef enum { LZ4F_noContentChecksum=0, LZ4F_contentChecksumEnabled - LZ4F_OBSOLETE_ENUM(noContentChecksum = LZ4F_noContentChecksum) - LZ4F_OBSOLETE_ENUM(contentChecksumEnabled = LZ4F_contentChecksumEnabled) + LZ4F_OBSOLETE_ENUM(noContentChecksum) + LZ4F_OBSOLETE_ENUM(contentChecksumEnabled) } LZ4F_contentChecksum_t; typedef enum { LZ4F_frame=0, LZ4F_skippableFrame - LZ4F_OBSOLETE_ENUM(skippableFrame = LZ4F_skippableFrame) + LZ4F_OBSOLETE_ENUM(skippableFrame) } LZ4F_frameType_t; #ifndef LZ4F_DISABLE_OBSOLETE_ENUMS |