From 2d4d31c18a739ba46f2c392e7649a315bdb1df74 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 16 May 2017 11:34:38 -0700 Subject: [PATCH] removed gcc compilation flag -Wbad-function-cast It makes it more difficult to directly cast the result of a function, requiring to store the result in an intermediate variable. It does not necessarily help readability, and this restriction can be difficult to overcome in some constructions, like some macros. also : fixed minor Visual conversion warnings in datagencli.c --- lib/Makefile | 8 ++++---- programs/Makefile | 8 ++++---- tests/Makefile | 8 ++++---- tests/datagencli.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index cc109944..f492c6bd 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -23,10 +23,10 @@ VERSION?= $(LIBVER) CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_ CFLAGS ?= -O3 DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wbad-function-cast -Wredundant-decls + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) FLAGS = $(CPPFLAGS) $(CFLAGS) diff --git a/programs/Makefile b/programs/Makefile index 9efa0007..ab2db728 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -42,10 +42,10 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -DXXH_NAMESPACE=ZSTD_ # because xxhash.o already compiled with this macro from library CFLAGS ?= -O3 DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wbad-function-cast -Wredundant-decls + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) diff --git a/tests/Makefile b/tests/Makefile index 560c36e1..c275c081 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -32,10 +32,10 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ $(DEBUGFLAG) CFLAGS ?= -O3 CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wformat-security \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wbad-function-cast -Wredundant-decls + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wformat-security \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls CFLAGS += $(MOREFLAGS) FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) diff --git a/tests/datagencli.c b/tests/datagencli.c index 3bb634b7..8a81939d 100644 --- a/tests/datagencli.c +++ b/tests/datagencli.c @@ -95,10 +95,10 @@ int main(int argc, const char** argv) break; case 'P': argument++; - probaU32=0.0; + probaU32 = 0; while ((*argument>='0') && (*argument<='9')) probaU32 *= 10, probaU32 += *argument++ - '0'; - if (probaU32>100.) probaU32=100.; + if (probaU32>100) probaU32 = 100; break; case 'L': /* hidden argument : Literal distribution probability */ argument++;