[PATCH 2/6] Cygwin: Fix warnings about narrowing conversions of NTSTATUS constants
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Aug 5 10:11:51 GMT 2024
On Aug 4 22:48, Jon Turney wrote:
> Fix warnings with gcc 12 about narrowing conversions of NTSTATUS
> constants when used as case labels, e.g:
>
> > ../../../../src/winsup/cygwin/exceptions.cc: In static member function ‘static int exception::handle(EXCEPTION_RECORD*, void*, CONTEXT*, PDISPATCHER_CONTEXT)’:
> > ../../../../src/winsup/cygwin/exceptions.cc:670:10: error: narrowing conversion of ‘-1073741682’ from ‘NTSTATUS’ {aka ‘int’} to ‘unsigned int’ [-Wnarrowing]
>
> See also: c5bdf60ac46401a51a7e974333d9622966e22d67
> ---
> winsup/cygwin/exceptions.cc | 2 +-
> winsup/cygwin/local_includes/ntdll.h | 2 +-
> winsup/cygwin/pinfo.cc | 2 +-
> winsup/cygwin/sigproc.cc | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
> index 28d0431d5..74e5905d5 100644
> --- a/winsup/cygwin/exceptions.cc
> +++ b/winsup/cygwin/exceptions.cc
> @@ -665,7 +665,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
> siginfo_t si = {};
> si.si_code = SI_KERNEL;
> /* Coerce win32 value to posix value. */
> - switch (e->ExceptionCode)
> + switch ((NTSTATUS)e->ExceptionCode)
I'd prefer a space after the closing parenthesis of the cast, but
we didn't enforce this in the past, so, please push.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list