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

Missing parentheses lead to build warnings #6

Open
NickLarsenNZ opened this issue Jun 12, 2017 · 1 comment
Open

Missing parentheses lead to build warnings #6

NickLarsenNZ opened this issue Jun 12, 2017 · 1 comment

Comments

@NickLarsenNZ
Copy link

Although the build succeeds, the compiler raises warnings. I'll send a PR soon.

nicklarsen@fourier:objconv$ g++ -o objconv -O2 src/*.cpp
src/disasm1.cpp:1135:36: warning: '&&' within '||' [-Wlogical-op-parentheses]
            if (s.AddressFieldSize && (s.MFlags & 0x100) || s.ImmediateFieldSize) {
                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ ~~
src/disasm1.cpp:1135:36: note: place parentheses around the '&&' expression to silence this warning
            if (s.AddressFieldSize && (s.MFlags & 0x100) || s.ImmediateFieldSize) {
                                   ^
                (                                       )
src/disasm1.cpp:1169:42: warning: '&&' within '||' [-Wlogical-op-parentheses]
        || (TargetType+1 & 0xFE) == 0x0C && (Symbols[SymNewI].Type & 0xFF) > 0x0C) {
        ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/disasm1.cpp:1169:42: note: place parentheses around the '&&' expression to silence this warning
        || (TargetType+1 & 0xFE) == 0x0C && (Symbols[SymNewI].Type & 0xFF) > 0x0C) {
                                         ^
           (                                                                     )
src/disasm1.cpp:2284:29: warning: '&&' within '||' [-Wlogical-op-parentheses]
    if ((s.Errors & 0x4000) && ((s.Warnings1 & 0x10000000) || CountErrors > 1)
        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/disasm1.cpp:2284:29: note: place parentheses around the '&&' expression to silence this warning
    if ((s.Errors & 0x4000) && ((s.Warnings1 & 0x10000000) || CountErrors > 1)
                            ^
        (                                                                     )
3 warnings generated.
NickLarsenNZ added a commit to NickLarsenNZ/objconv that referenced this issue Jun 12, 2017
@NickLarsenNZ
Copy link
Author

Pinging @vertis

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

No branches or pull requests

1 participant