fix compilation warning (enum out of range) in winedbg

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

fix compilation warning (enum out of range) in winedbg

vlad.bespalov
when compiled with clang the following warning message is produced:

../../../programs/winedbg/gdbproxy.c:1586:27: warning: comparison of  
constant -1 with expression of type 'enum be_xpoint_type' is always  
true [-Wtautological-constant-out-of-range-compare]
             if (xpt->type != -1 && xpt_addr >= addr && xpt_addr <  
addr + blk_len)
                 ~~~~~~~~~ ^  ~~
../../../programs/winedbg/gdbproxy.c:2236:23: warning: comparison of  
constant -1 with expression of type 'enum be_xpoint_type' is always  
false [-Wtautological-constant-out-of-range-compare]
         if (xpt->type == -1)
             ~~~~~~~~~ ^  ~~
2 warnings generated.

compiler is free to choose underlying type as long as all defined
enum entries fit into it, so as no negative values were defined,
it can be expected to use unsigned underlying type and drop the checks.

Proposed patch adds explicit enum member with value (-1) to make sure
underlying type would have this value allowed.

Thanks,
Vlad.



0001-Fix-compilation-warning.patch (2K) Download Attachment