From 19df3029e234e4c48c31377c9ef5f7c940da5106 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 18 Nov 2016 17:54:26 -0800 Subject: [PATCH] fixed #272 (compilation fails on gcc 4.4), reported by @totaam --- Makefile | 6 +++++- NEWS | 1 + README.md | 2 ++ lib/Makefile | 4 ++-- lib/lz4.h | 5 +++-- tests/Makefile | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a97c4ed0e..25cedbcd1 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ endif .PHONY: default all lib lz4 clean test versionsTest examples -default: lib lz4 +default: lib lz4-release all: @$(MAKE) -C $(LZ4DIR) $@ @@ -62,6 +62,10 @@ lib: @$(MAKE) -C $(LZ4DIR) lz4: + @$(MAKE) -C $(PRGDIR) $@ + @cp $(PRGDIR)/lz4$(EXT) . + +lz4-release: @$(MAKE) -C $(PRGDIR) @cp $(PRGDIR)/lz4$(EXT) . diff --git a/NEWS b/NEWS index 1b2daa40f..bb9d1fbc1 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ v1.7.4 Improved : much better speed in -mx32 mode cli : fix : Large file support in 32-bits mode on Mac OS-X +fix : compilation on gcc 4.4 (#282), reported by Antoine Martin v1.7.3 Changed : moved to versioning; package, cli and library have same version number diff --git a/README.md b/README.md index 1b4a007cc..04ba0dbee 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ in single-thread mode. [zlib]: http://www.zlib.net/ [Zstandard]: http://www.zstd.net/ +LZ4 is also compatible and well optimized for x32 mode, for which it provides +10% speed performance. + Documentation ------------------------- diff --git a/lib/Makefile b/lib/Makefile index 216d136e9..d6e366811 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -46,7 +46,7 @@ DESTDIR?= PREFIX ?= /usr/local CPPFLAGS= -DXXH_NAMESPACE=LZ4_ CFLAGS ?= -O3 -CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ +CFLAGS += -g -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef \ -Wpointer-arith -Wstrict-aliasing=1 CFLAGS += $(MOREFLAGS) @@ -102,7 +102,7 @@ else endif clean: - @$(RM) core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* liblz4.pc dll/liblz4.dll dll/liblz4.lib + @$(RM) core *.o *.a *.$(SHARED_EXT) liblz4.pc dll/liblz4.dll dll/liblz4.lib @echo Cleaning library completed diff --git a/lib/lz4.h b/lib/lz4.h index ec758fef2..49854e4c2 100644 --- a/lib/lz4.h +++ b/lib/lz4.h @@ -412,9 +412,10 @@ union LZ4_streamDecode_u { #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS # define LZ4_DEPRECATED(message) /* disable deprecation warnings */ #else -# if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) +# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +# if (LZ4_GCC_VERSION >= 405) || defined(__clang__) # define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) -# elif defined(__GNUC__) && (__GNUC__ >= 3) +# elif (LZ4_GCC_VERSION >= 301) # define LZ4_DEPRECATED(message) __attribute__((deprecated)) # elif defined(_MSC_VER) # define LZ4_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/tests/Makefile b/tests/Makefile index 288b665cf..e58d44907 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -39,7 +39,7 @@ TESTDIR := versionsTest PYTHON ?= python3 CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make -CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ +CFLAGS += -g -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ -Wdeclaration-after-statement -Wstrict-prototypes \ -Wpointer-arith -Wstrict-aliasing=1 CFLAGS += $(MOREFLAGS)