Skip to content

Commit 2da2a43

Browse files
committed
Appease clang -Wshadow
The macros BSWAP4 and BSWAP8 have statetemnt expressions implementations that use local variable names that shadow variables outside the macro call, generating warnings like this e_aes_cbc_hmac_sha1.c:263:14: warning: declaration shadows a local variable [-Wshadow] seqnum = BSWAP8(blocks[0].q[0]); ^ ../modes/modes_lcl.h:41:29: note: expanded from macro 'BSWAP8' ^ e_aes_cbc_hmac_sha1.c:223:12: note: previous declaration is here size_t ret = 0; ^ Have clang be quiet by modifying the macro variable names slightly (suffixing them with an underscore). Reviewed-by: Rich Salz <[email protected]>
1 parent 04958e8 commit 2da2a43

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

crypto/modes/modes_lcl.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,36 @@ typedef unsigned char u8;
3838
#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
3939
# if defined(__GNUC__) && __GNUC__>=2
4040
# if defined(__x86_64) || defined(__x86_64__)
41-
# define BSWAP8(x) ({ u64 ret=(x); \
41+
# define BSWAP8(x) ({ u64 ret_=(x); \
4242
asm ("bswapq %0" \
43-
: "+r"(ret)); ret; })
44-
# define BSWAP4(x) ({ u32 ret=(x); \
43+
: "+r"(ret_)); ret_; })
44+
# define BSWAP4(x) ({ u32 ret_=(x); \
4545
asm ("bswapl %0" \
46-
: "+r"(ret)); ret; })
46+
: "+r"(ret_)); ret_; })
4747
# elif (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
48-
# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
48+
# define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x); \
4949
asm ("bswapl %0; bswapl %1" \
50-
: "+r"(hi),"+r"(lo)); \
51-
(u64)hi<<32|lo; })
52-
# define BSWAP4(x) ({ u32 ret=(x); \
50+
: "+r"(hi_),"+r"(lo_)); \
51+
(u64)hi_<<32|lo_; })
52+
# define BSWAP4(x) ({ u32 ret_=(x); \
5353
asm ("bswapl %0" \
54-
: "+r"(ret)); ret; })
54+
: "+r"(ret_)); ret_; })
5555
# elif defined(__aarch64__)
56-
# define BSWAP8(x) ({ u64 ret; \
56+
# define BSWAP8(x) ({ u64 ret_; \
5757
asm ("rev %0,%1" \
58-
: "=r"(ret) : "r"(x)); ret; })
59-
# define BSWAP4(x) ({ u32 ret; \
58+
: "=r"(ret_) : "r"(x)); ret_; })
59+
# define BSWAP4(x) ({ u32 ret_; \
6060
asm ("rev %w0,%w1" \
61-
: "=r"(ret) : "r"(x)); ret; })
61+
: "=r"(ret_) : "r"(x)); ret_; })
6262
# elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT)
63-
# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
63+
# define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x); \
6464
asm ("rev %0,%0; rev %1,%1" \
65-
: "+r"(hi),"+r"(lo)); \
66-
(u64)hi<<32|lo; })
67-
# define BSWAP4(x) ({ u32 ret; \
65+
: "+r"(hi_),"+r"(lo_)); \
66+
(u64)hi_<<32|lo_; })
67+
# define BSWAP4(x) ({ u32 ret_; \
6868
asm ("rev %0,%1" \
69-
: "=r"(ret) : "r"((u32)(x))); \
70-
ret; })
69+
: "=r"(ret_) : "r"((u32)(x))); \
70+
ret_; })
7171
# endif
7272
# elif defined(_MSC_VER)
7373
# if _MSC_VER>=1300

0 commit comments

Comments
 (0)