Skip to content

Commit 88034a1

Browse files
committed
Fixed warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning
1 parent 6b4b492 commit 88034a1

File tree

3 files changed

+39
-33
lines changed

3 files changed

+39
-33
lines changed

src/miniz.h

+25-19
Original file line numberDiff line numberDiff line change
@@ -2006,22 +2006,26 @@ static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, int
20062006
} \
20072007
} MZ_MACRO_END
20082008

2009-
#define TDEFL_RLE_PREV_CODE_SIZE() { if (rle_repeat_count) { \
2010-
if (rle_repeat_count < 3) { \
2011-
d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \
2012-
while (rle_repeat_count--) packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \
2013-
} else { \
2014-
d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); packed_code_sizes[num_packed_code_sizes++] = 16; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \
2015-
} rle_repeat_count = 0; } }
2016-
2017-
#define TDEFL_RLE_ZERO_CODE_SIZE() { if (rle_z_count) { \
2018-
if (rle_z_count < 3) { \
2019-
d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \
2020-
} else if (rle_z_count <= 10) { \
2021-
d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); packed_code_sizes[num_packed_code_sizes++] = 17; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \
2022-
} else { \
2023-
d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); packed_code_sizes[num_packed_code_sizes++] = 18; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \
2024-
} rle_z_count = 0; } }
2009+
#define TDEFL_RLE_PREV_CODE_SIZE() do { \
2010+
if (rle_repeat_count) { \
2011+
if (rle_repeat_count < 3) { \
2012+
d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \
2013+
while (rle_repeat_count--) packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \
2014+
} else { \
2015+
d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); packed_code_sizes[num_packed_code_sizes++] = 16; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \
2016+
} rle_repeat_count = 0; } \
2017+
} MZ_MACRO_END
2018+
2019+
#define TDEFL_RLE_ZERO_CODE_SIZE() do { \
2020+
if (rle_z_count) { \
2021+
if (rle_z_count < 3) { \
2022+
d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \
2023+
} else if (rle_z_count <= 10) { \
2024+
d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); packed_code_sizes[num_packed_code_sizes++] = 17; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \
2025+
} else { \
2026+
d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); packed_code_sizes[num_packed_code_sizes++] = 18; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \
2027+
} rle_z_count = 0; } \
2028+
} MZ_MACRO_END
20252029

20262030
static mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
20272031

@@ -2366,11 +2370,12 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
23662370
for ( ; ; )
23672371
{
23682372
if (--num_probes_left == 0) return;
2369-
#define TDEFL_PROBE \
2373+
#define TDEFL_PROBE do { \
23702374
next_probe_pos = d->m_next[probe_pos]; \
23712375
if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \
23722376
probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
23732377
if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break;
2378+
} MZ_MACRO_END
23742379
TDEFL_PROBE;
23752380
TDEFL_PROBE;
23762381
TDEFL_PROBE;
@@ -2405,11 +2410,12 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
24052410
for ( ; ; )
24062411
{
24072412
if (--num_probes_left == 0) return;
2408-
#define TDEFL_PROBE \
2413+
#define TDEFL_PROBE do { \
24092414
next_probe_pos = d->m_next[probe_pos]; \
24102415
if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \
24112416
probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
2412-
if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break;
2417+
if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break; \
2418+
} MZ_MACRO_END
24132419
TDEFL_PROBE;
24142420
TDEFL_PROBE;
24152421
TDEFL_PROBE;

src/stb_image.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -2723,7 +2723,7 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
27232723
b = _mm_unpackhi_epi16(tmp, b)
27242724

27252725
#define dct_pass(bias,shift) \
2726-
{ \
2726+
do { \
27272727
/* even part */ \
27282728
dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \
27292729
__m128i sum04 = _mm_add_epi16(row0, row4); \
@@ -2748,7 +2748,7 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
27482748
dct_bfly32o(row1,row6, x1,x6,bias,shift); \
27492749
dct_bfly32o(row2,row5, x2,x5,bias,shift); \
27502750
dct_bfly32o(row3,row4, x3,x4,bias,shift); \
2751-
}
2751+
} while ( 0 )
27522752

27532753
__m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f));
27542754
__m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f));
@@ -2887,15 +2887,15 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
28872887

28882888
// butterfly a/b, then shift using "shiftop" by "s" and pack
28892889
#define dct_bfly32o(out0,out1, a,b,shiftop,s) \
2890-
{ \
2890+
do { \
28912891
dct_wadd(sum, a, b); \
28922892
dct_wsub(dif, a, b); \
28932893
out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \
28942894
out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \
2895-
}
2895+
} while ( 0 )
28962896

28972897
#define dct_pass(shiftop, shift) \
2898-
{ \
2898+
do { \
28992899
/* even part */ \
29002900
int16x8_t sum26 = vaddq_s16(row2, row6); \
29012901
dct_long_mul(p1e, sum26, rot0_0); \
@@ -2932,7 +2932,7 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
29322932
dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \
29332933
dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \
29342934
dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \
2935-
}
2935+
} while ( 0 )
29362936

29372937
// load
29382938
row0 = vld1q_s16(data + 0*8);
@@ -2954,9 +2954,9 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
29542954
{
29552955
// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively.
29562956
// whether compilers actually get this is another story, sadly.
2957-
#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; }
2958-
#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); }
2959-
#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); }
2957+
#define dct_trn16(x, y) do { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; } while ( 0 )
2958+
#define dct_trn32(x, y) do { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); } while ( 0 )
2959+
#define dct_trn64(x, y) do { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); } while ( 0 )
29602960

29612961
// pass 1
29622962
dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6
@@ -2999,9 +2999,9 @@ static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
29992999
uint8x8_t p7 = vqrshrun_n_s16(row7, 1);
30003000

30013001
// again, these can translate into one instruction, but often don't.
3002-
#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; }
3003-
#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); }
3004-
#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); }
3002+
#define dct_trn8_8(x, y) do { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; } while ( 0 )
3003+
#define dct_trn8_16(x, y) do { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); } while ( 0 )
3004+
#define dct_trn8_32(x, y) do { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); } while ( 0 )
30053005

30063006
// sadly can't use interleaved stores here since we only write
30073007
// 8 bytes to each scan line!

src/tiny_jpeg.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ int tje_encode_with_func(tje_write_func* func,
168168
#ifdef TJE_IMPLEMENTATION
169169

170170

171-
#define tjei_min(a, b) ((a) < b) ? (a) : (b);
172-
#define tjei_max(a, b) ((a) < b) ? (b) : (a);
171+
#define tjei_min(a, b) ((a) < b) ? (a) : (b)
172+
#define tjei_max(a, b) ((a) < b) ? (b) : (a)
173173

174174

175175
#if defined(_MSC_VER)

0 commit comments

Comments
 (0)