objconv icon indicating copy to clipboard operation
objconv copied to clipboard

Missing parentheses lead to build warnings

Open NickLarsenNZ opened this issue 8 years ago • 1 comments

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 avatar Jun 12 '17 19:06 NickLarsenNZ

Pinging @vertis

NickLarsenNZ avatar Jun 20 '17 10:06 NickLarsenNZ