[Bug c/81448] False positive -Werror=multistatement-macros in openssl

bernd.edlinger at hotmail dot de gcc-bugzilla@gcc.gnu.org
Fri Jul 14 16:50:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81448

--- Comment #2 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Not really:

diff --git a/crypto/evp/evp_locl.h b/crypto/evp/evp_locl.h
index 2bb709a..cb44ed8 100644
--- a/crypto/evp/evp_locl.h
+++ b/crypto/evp/evp_locl.h
@@ -71,8 +71,9 @@
 #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
 static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const
unsigned char *in, size_t inl) \
 {\
-        BLOCK_CIPHER_ecb_loop() \
+        BLOCK_CIPHER_ecb_loop() { \
                 cprefix##_ecb_encrypt(in + i, out + i, &((kstruct
*)ctx->cipher_data)->ksched, ctx->encrypt);\
+        } \
         return 1;\
 }

In file included from e_bf.c:63:0:
e_bf.c: In function 'bf_ecb_cipher':
evp_locl.h:74:33: error: macro expands to multiple statements
[-Werror=multistatement-macros]
         BLOCK_CIPHER_ecb_loop() { \
                                 ^
evp_locl.h:132:9: note: in expansion of macro 'BLOCK_CIPHER_func_ecb'
         BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
         ^~~~~~~~~~~~~~~~~~~~~
evp_locl.h:251:9: note: in expansion of macro 'BLOCK_CIPHER_all_funcs'
         BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
         ^~~~~~~~~~~~~~~~~~~~~~
e_bf.c:76:1: note: in expansion of macro 'IMPLEMENT_BLOCK_CIPHER'
 IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
 ^~~~~~~~~~~~~~~~~~~~~~
evp_locl.h:69:9: note: some parts of macro expansion are not guarded by this
'for' clause
         for(i=0; i <= inl; i+=bl)
         ^~~
evp_locl.h:74:9: note: in expansion of macro 'BLOCK_CIPHER_ecb_loop'
         BLOCK_CIPHER_ecb_loop() { \
         ^~~~~~~~~~~~~~~~~~~~~
evp_locl.h:132:9: note: in expansion of macro 'BLOCK_CIPHER_func_ecb'
         BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
         ^~~~~~~~~~~~~~~~~~~~~
evp_locl.h:251:9: note: in expansion of macro 'BLOCK_CIPHER_all_funcs'
         BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
         ^~~~~~~~~~~~~~~~~~~~~~
e_bf.c:76:1: note: in expansion of macro 'IMPLEMENT_BLOCK_CIPHER'
 IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
 ^~~~~~~~~~~~~~~~~~~~~~


More information about the Gcc-bugs mailing list