Fix : compiler-independent macro to remove deprecation warnings

This commit is contained in:
Yann Collet 2015-10-21 12:58:06 +01:00
parent 64f8b037ee
commit ff3324b8d5
2 changed files with 17 additions and 16 deletions

View File

@ -300,7 +300,6 @@ int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compresse
int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
/**************************************
* Obsolete Functions
**************************************/
@ -309,10 +308,11 @@ int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalS
it is generally possible to disable them,
with -Wno-deprecated-declarations for gcc
or _CRT_SECURE_NO_WARNINGS in Visual for example.
You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */
#ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK
# define LZ4_DEPRECATE_WARNING_DEFBLOCK
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
Otherwise, you can also define LZ4_DISABLE_DEPRECATE_WARNINGS */
#define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED() /* disable deprecation warnings */
#else
# if (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
@ -323,10 +323,10 @@ int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalS
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# endif
#endif /* LZ4_DEPRECATE_WARNING_DEFBLOCK */
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
/* Obsolete compression functions */
/* These functions are planned to start generate warnings by r131 approximately */
/* These functions will generate warnings in a future release */
int LZ4_compress (const char* source, char* dest, int sourceSize);
int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
@ -336,7 +336,7 @@ int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const cha
/* Obsolete decompression functions */
/* These function names are completely deprecated and must no longer be used.
They are only provided here for compatibility with older programs.
They are only provided in lz4.c for compatibility with older programs.
- LZ4_uncompress is the same as LZ4_decompress_fast
- LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe
These function prototypes are now disabled; uncomment them only if you really need them.

View File

@ -36,17 +36,17 @@
RELEASE ?= r132
DESTDIR ?=
PREFIX ?= /usr/local
CFLAGS ?= -O3 # can select customized flags instead, for example : CFLAGS="-O2 -g" make
CFLAGS += -I../lib -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic
CPPFLAGS:= -DXXH_NAMESPACE=LZ4_ -DLZ4_VERSION=\"$(RELEASE)\"
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
BINDIR := $(PREFIX)/bin
MANDIR := $(PREFIX)/share/man/man1
LZ4DIR := ../lib
DESTDIR ?=
PREFIX ?= /usr/local
CFLAGS ?= -O3 # can select customized optimized flags such as for example : CFLAGS="-O2 -g" make
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic
CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_ -DLZ4_VERSION=\"$(RELEASE)\"
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
# Define *.exe as extension for Windows systems
ifneq (,$(filter Windows%,$(OS)))
@ -58,7 +58,7 @@ VOID = /dev/null
endif
# Select test target for Travis CI's Build Matrix
# Default test parameters
TEST_FILES := COPYING
FUZZER_TIME := -T9mn
@ -102,6 +102,7 @@ datagen : datagen.o datagencli.c
$(CC) $(FLAGS) $^ -o $@$(EXT)
clean:
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
@rm -f core *.o *.test tmp* \
lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) \
fullbench$(EXT) fullbench32$(EXT) \