Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fishilico
Copy link

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

When building the library with clang, 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 );
                                  ^

Instead of removing all the semicolons, introduce `do { ... } while (0)`
construction in the macros which are used like function calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant