public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_5-branch] Cygwin: Fix warnings about narrowing conversions of NTSTATUS constants
@ 2024-08-22 20:37 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-08-22 20:37 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6204d84db7855e944def8cda7feb676e836fc7ac
commit 6204d84db7855e944def8cda7feb676e836fc7ac
Author: Jon Turney <jon.turney@dronecode.org.uk>
AuthorDate: Sun Aug 4 16:30:16 2024 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Aug 22 19:58:49 2024 +0200
Cygwin: Fix warnings about narrowing conversions of NTSTATUS constants
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
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Diff:
---
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 28d0431d528f..3195d5719a14 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)
{
case STATUS_FLOAT_DIVIDE_BY_ZERO:
si.si_signo = SIGFPE;
diff --git a/winsup/cygwin/local_includes/ntdll.h b/winsup/cygwin/local_includes/ntdll.h
index 7737ae503c18..4497fe53f9b5 100644
--- a/winsup/cygwin/local_includes/ntdll.h
+++ b/winsup/cygwin/local_includes/ntdll.h
@@ -23,7 +23,7 @@ extern GUID __cygwin_socket_guid;
/* Custom Cygwin-only status codes. */
#define STATUS_THREAD_SIGNALED ((NTSTATUS)0xe0000001)
#define STATUS_THREAD_CANCELED ((NTSTATUS)0xe0000002)
-#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((DWORD) 0xe0000269)
+#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
/* Simplify checking for a transactional error code. */
#define NT_TRANSACTIONAL_ERROR(s) \
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index bfd338e5b85a..a5f5d6eb22a0 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -118,7 +118,7 @@ pinfo_init (char **envp, int envc)
DWORD
pinfo::status_exit (DWORD x)
{
- switch (x)
+ switch ((NTSTATUS) x)
{
case STATUS_DLL_NOT_FOUND:
{
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 86e4e607ab7e..99fa3c3425c3 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1082,7 +1082,7 @@ child_info::proc_retry (HANDLE h)
if (!exit_code)
return EXITCODE_OK;
sigproc_printf ("exit_code %y", exit_code);
- switch (exit_code)
+ switch ((NTSTATUS) exit_code)
{
case STILL_ACTIVE: /* shouldn't happen */
sigproc_printf ("STILL_ACTIVE? How'd we get here?");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-22 20:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-22 20:37 [newlib-cygwin/cygwin-3_5-branch] Cygwin: Fix warnings about narrowing conversions of NTSTATUS constants Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).