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

Michael Stefaniuc mstefani at redhat.com
Mon Jun 22 03:08:08 CDT 2015


Hello Gerald,

On 06/19/2015 11:48 PM, Gerald Pfeifer wrote:
> 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.
adding an element be_xpoint_free to the enum is better than a cast.

> 
> 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, 
> 

bye
	michael



More information about the wine-devel mailing list