This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81448] False positive -Werror=multistatement-macros in openssl
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Jul 2017 20:32:48 +0000
- Subject: [Bug c/81448] False positive -Werror=multistatement-macros in openssl
- Auto-submitted: auto-generated
- References: <bug-81448-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81448
--- Comment #6 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Marek Polacek from comment #5)
> PR81364 is fixed, do you still see any false positives?
Well adding braces would fix the warning,
but consider this slightly reduced test case:
void b_ecb_encrypt();
#define BLOCK_CIPHER_ecb_loop() \
int i, bl; \
bl = 100; \
if (inl < bl) return 1; \
inl -= bl; \
for (i=0; i <= inl; i+=bl)
#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
int cname##_ecb_cipher(char *out, char *in, int inl) \
{ \
BLOCK_CIPHER_ecb_loop() \
cprefix##_ecb_encrypt(in + i, out + i); \
return 1; \
}
BLOCK_CIPHER_func_ecb(a,b,c,d)
int test(unsigned char *out, const unsigned char *in, int inl)
{
BLOCK_CIPHER_ecb_loop()
b_ecb_encrypt(in + i, out + i);
return 1;
}
Why is the warning only in the macro expansion
and not in explicit instantiation ?