From cbbc0b2a3ede1234b66ebdc394aad725a67b5910 Mon Sep 17 00:00:00 2001 From: Mika Lindqvist Date: Wed, 29 Apr 2015 19:09:26 +0300 Subject: [PATCH] Fix forced inlining to work with Visual Studio. --- deflate.c | 2 +- win32/Makefile.msc | 2 +- zutil.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deflate.c b/deflate.c index da42bb30..09d486c4 100644 --- a/deflate.c +++ b/deflate.c @@ -213,7 +213,7 @@ local inline Pos insert_string(deflate_state *z_const s, z_const Pos str) #ifndef NOT_TWEAK_COMPILER -__attribute__ ((always_inline)) local void +alwaysinline local void bulk_insert_str(deflate_state *s, Pos startpos, uInt count) { uInt idx; for (idx = 0; idx < count; idx++) { diff --git a/win32/Makefile.msc b/win32/Makefile.msc index d7a9ec8d..318be92e 100644 --- a/win32/Makefile.msc +++ b/win32/Makefile.msc @@ -22,7 +22,7 @@ LD = link AR = lib RC = rc CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOT_TWEAK_COMPILER +WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest ARFLAGS = -nologo RCFLAGS = /dWIN32 /r diff --git a/zutil.h b/zutil.h index 5feddb24..d0cab497 100644 --- a/zutil.h +++ b/zutil.h @@ -96,6 +96,12 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ But it provides __inline instead, so use that. */ #if defined(_MSC_VER) && !defined(inline) # define inline __inline +#endif + +#if defined(_MSC_VER) +# define alwaysinline __forceinline +#else +# define alwaysinline __attribute__ ((always_inline)) #endif /* common defaults */ -- 2.47.2