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

Pedro Alves palves@redhat.com
Wed Aug 29 19:09:00 GMT 2018


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



More information about the Gdb-patches mailing list