# (who'd use cmake from an IDE...) but checking for ICC before checking for MSVC should
# avoid mistakes.
# /Oi ?
- set(WARNFLAGS /W3)
+ set(WARNFLAGS /W3 /w34242 /WX)
set(WARNFLAGS_MAINTAINER /W4)
- set(WARNFLAGS_DISABLE)
+ set(WARNFLAGS_DISABLE /wd4206 /wd4054)
if(BASEARCH_ARM_FOUND)
add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
if(NOT "${ARCH}" MATCHES "aarch64")
a = vld1_u8(buf);
b = vld1_u8(buf + 8);
ret0 = vtbl1_u8(a, perm_vec0);
- uint8x8x2_t ab = {{a, b}};
+ uint8x8x2_t ab;
+ ab.val[0] = a;
+ ab.val[1] = b;
ret1 = vtbl2_u8(ab, perm_vec1);
return vcombine_u8(ret0, ret1);
#endif
# ifndef ARM_NEON_HASLD4
static inline uint16x8x4_t vld1q_u16_x4(uint16_t const *a) {
- uint16x8x4_t ret = (uint16x8x4_t) {{
- vld1q_u16(a),
- vld1q_u16(a+8),
- vld1q_u16(a+16),
- vld1q_u16(a+24)}};
+ uint16x8x4_t ret;
+ ret.val[0] = vld1q_u16(a);
+ ret.val[1] = vld1q_u16(a+8);
+ ret.val[2] = vld1q_u16(a+16);
+ ret.val[3] = vld1q_u16(a+24);
return ret;
}
static inline uint8x16x4_t vld1q_u8_x4(uint8_t const *a) {
- uint8x16x4_t ret = (uint8x16x4_t) {{
- vld1q_u8(a),
- vld1q_u8(a+16),
- vld1q_u8(a+32),
- vld1q_u8(a+48)}};
+ uint8x16x4_t ret;
+ ret.val[0] = vld1q_u8(a);
+ ret.val[1] = vld1q_u8(a+16);
+ ret.val[2] = vld1q_u8(a+32);
+ ret.val[3] = vld1q_u8(a+48);
return ret;
}
#include <immintrin.h>
#include <stdint.h>
+
+/* Written because Visual C++ toolchains before v142 have constant overflow in AVX512 intrinsic macros */
+#if defined(_MSC_VER) && !defined(_MM_K0_REG8)
+# undef _mm512_extracti64x4_epi64
+# define _mm512_extracti64x4_epi64(v1, e1) _mm512_maskz_extracti64x4_epi64(UINT8_MAX, v1, e1)
+# undef _mm512_set1_epi16
+# define _mm512_set1_epi16(e1) _mm512_maskz_set1_epi16(UINT32_MAX, e1)
+# undef _mm512_maddubs_epi16
+# define _mm512_maddubs_epi16(v1, v2) _mm512_maskz_maddubs_epi16(UINT32_MAX, v1, v2)
+#endif
+
/* Written because *_add_epi32(a) sets off ubsan */
static inline uint32_t _mm512_reduce_add_epu32(__m512i x) {
__m256i a = _mm512_extracti64x4_epi64(x, 1);
#endif // __AVX512F__
#endif // defined(_MSC_VER) && _MSC_VER < 1914
+/* Visual C++ toolchains before v142 have constant overflow in AVX512 intrinsics */
+#if defined(_MSC_VER) && defined(__AVX512F__) && !defined(_MM_K0_REG8)
+# undef _mm512_extracti32x4_epi32
+# define _mm512_extracti32x4_epi32(v1, e1) _mm512_maskz_extracti32x4_epi32(UINT8_MAX, v1, e1)
+#endif
#endif // include guard X86_INTRINS_H
int nice_match; /* Stop searching when current match exceeds this */
+#if defined(_M_IX86) || defined(_M_ARM)
+ int padding[2];
+#endif
+
struct crc32_fold_s ALIGNED_(16) crc_fold;
/* used by trees.c: */
/* Number of valid bits in bi_buf. All bits above the last valid bit are always zero. */
/* Reserved for future use and alignment purposes */
- int32_t reserved[11];
+ int32_t reserved[19];
+#if defined(_M_IX86) || defined(_M_ARM)
+ int32_t padding2[4];
+#endif
};
typedef enum {
uint32_t whave; /* valid bytes in the window */
uint32_t wnext; /* window write index */
unsigned char *window; /* allocated sliding window, if needed */
+#if defined(_M_IX86) || defined(_M_ARM)
+ uint32_t padding;
+#else
+ uint32_t padding[2];
+#endif
struct crc32_fold_s ALIGNED_(16) crc_fold;
#ifdef HAVE_ARCH_INFLATE_STATE
arch_inflate_state arch; /* architecture-specific extensions */
#endif
+#if defined(_M_IX86) || defined(_M_ARM)
+ int padding2[8];
+#endif
};
void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state);
add_executable(gtest_zlib ${TEST_SRCS})
configure_test_executable(gtest_zlib)
+ if(MSVC)
+ target_compile_options(gtest_zlib PRIVATE /wd4389)
+ if(BASEARCH_ARM_FOUND)
+ target_compile_options(gtest_zlib PRIVATE /EHsc)
+ endif()
+ endif()
+
if(WITH_SANITIZER STREQUAL "Memory")
target_link_directories(gtest_zlib PRIVATE $ENV{LLVM_BUILD_DIR}/lib)
target_link_options(gtest_zlib PRIVATE
}
if (len == 0)
break;
- assert(0 == memcmp(data + offset, buf, len));
+ int c = memcmp(data + offset, buf, len);
+ assert(0 == c);
+ Z_UNUSED(c); // in Release build, assert() is a no-op.
offset += len;
}
gzFile file;
int err;
+ Z_UNUSED(compr);
/* Write gz file with test data */
file = PREFIX(gzopen)(TESTFILE, "wb");
ASSERT_TRUE(file != NULL);
# include <stdio.h>
extern int Z_INTERNAL z_verbose;
extern void Z_INTERNAL z_error(const char *m);
-# define Assert(cond, msg) {if (!(cond)) z_error(msg);}
+# define Assert(cond, msg) {int _cond = (cond); if (!_cond) z_error(msg);}
# define Trace(x) {if (z_verbose >= 0) fprintf x;}
# define Tracev(x) {if (z_verbose > 0) fprintf x;}
# define Tracevv(x) {if (z_verbose > 1) fprintf x;}