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

Pedro Alves
2018-08-29T19:09:35Z

On 08/29/2018 07:59 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
>
> Tom> So, I've added a DWORD cast there as well; then restore the #if.
>
> That's not going to work either, is it?
> Since the test is
>
> for (i = 0; xlate[i].them != -1; i++)
>
> ... and it should be for (DWORD) -1 ?
>

If you're going to fix it, I'd go with my earlier suggestion:

It'd be easily fixable by removing that terminator
entry and using range-for in the other #if 0 block.

I.e., remote the -1 entry, and replace:

for (i = 0; xlate[i].them != -1; i++)
if (xlate[i].us == sig)
{
current_event.u.Exception.ExceptionRecord.ExceptionCode
= xlate[i].them;

with:

for (const xlate_exception &x : xlate)
if (x.us == sig)
{
current_event.u.Exception.ExceptionRecord.ExceptionCode
= x.them;

Thanks,
Pedro Alves