WjCryptLib icon indicating copy to clipboard operation
WjCryptLib copied to clipboard

Use do { ... } while (0) to silence clang's -Wextra-semi-stmt

Open fishilico opened this issue 3 years ago • 0 comments

Hello,

First, thank you for making this code public! It is quite helpful and it is nice to have cryptographic functions implemented in a way which does not require integrating a large library.

I am using it in a project which I build with clang and many compiler warning files. When doing this, several warnings are emitted due to using macros as statements ending with a semicolon:

WjCryptLib/lib/WjCryptLib_Aes.c:899:31: warning: empty expression
statement has no effect; remove unnecessary ';' to silence this
warning [-Wextra-semi-stmt]
    STORE32H( s2, Output + 8 );
                              ^

Here is a Pull Request which introduces do { ... } while (0) constructions in the macros which are used like function calls. If you prefer silencing these warnings in another way, I am open to discussion.

Thanks

fishilico avatar May 29 '22 14:05 fishilico