winedbg: Avoid direct comparison of enum with -1 in packet_set_breakpoint.

Gerald Pfeifer gerald at pfeifer.com
Sun Jun 21 14:31:01 CDT 2015


[ Resent from proper e-mail address. ]

clang 3.4.1 complains as follows when compiling this:

  gdbproxy.c:2147:23: warning: comparison of constant -1 with 
  expression of type 'enum be_xpoint_type' is always false

I see two ways to address this: adding a dummy set to -1 to the
enum, or casting the enum to int before comparing against -1.

The patch below implements the first approach; if you prefer,
I'll provide a patch for the other approach.

Gerald
---
 programs/winedbg/gdbproxy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index dd63f7d..181b32a 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -2144,7 +2144,7 @@ static enum packet_return packet_set_breakpoint(struct gdb_context* gdbctx)
     /* really set the Xpoint */
     for (xpt = &gdbctx->Xpoints[NUM_XPOINT - 1]; xpt >= gdbctx->Xpoints; xpt--)
     {
-        if (xpt->type == -1)
+        if ((int)xpt->type == -1)
         {
             if (be_cpu->insert_Xpoint(gdbctx->process->handle,
                                       gdbctx->process->process_io, &gdbctx->context, 
-- 
2.4.2



More information about the wine-patches mailing list