Re: [PATCH] Fix windows-nat.c for -Wnarrowing

Pedro Alves
2018-08-29T18:39:34Z

On 08/29/2018 06:42 PM, Tom Tromey wrote:

> gdb/ChangeLog
> 2018-08-29 Tom Tromey <tom@tromey.com>
>
> * windows-nat.c (struct xlate_exception) <them>: Change type to
> DWORD.
> (xlate): Fix formatting.
> (struct xlate_exception, xlate): Comment out.

This is OK as is.

> -static const struct xlate_exception
> - xlate[] =
> +static const struct xlate_exception xlate[] =
> {
> {EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV},
> {STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV},
> @@ -298,8 +300,10 @@ static const struct xlate_exception
> {DBG_CONTROL_C, GDB_SIGNAL_INT},
> {EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP},
> {STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
> - {-1, GDB_SIGNAL_UNKNOWN}};
> + {-1, GDB_SIGNAL_UNKNOWN}
> +};
I guess that -1 would still cause a -Wnarrowing warning.
If so, it'd be easily fixable by removing that terminator
entry and using range-for in the other #if 0 block.
Just thinking out loud. Please don't bother.

Thanks,
Pedro Alves