Skip to content

Missing parentheses lead to build warnings #6

@NickLarsenNZ

Description

@NickLarsenNZ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions