public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: avoid GCC 10 error with -Werror=narrowing
@ 2020-09-28 13:12 Jon TURNEY
0 siblings, 0 replies; 2+ messages in thread
From: Jon TURNEY @ 2020-09-28 13:12 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c5bdf60ac46401a51a7e974333d9622966e22d67
commit c5bdf60ac46401a51a7e974333d9622966e22d67
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat Sep 19 16:15:40 2020 +0100
Cygwin: avoid GCC 10 error with -Werror=narrowing
../../../../src/winsup/cygwin/pinfo.cc: In member function 'DWORD pinfo::status_exit(DWORD)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/pinfo.cc:136:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'
../../../../src/winsup/cygwin/sigproc.cc: In member function 'DWORD child_info::proc_retry(HANDLE)':
../../../../src/winsup/cygwin/ntdll.h:21:68: error: narrowing conversion of '-536870295' from 'NTSTATUS' {aka 'int'} to 'unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/sigproc.cc:1120:10: note: in expansion of macro 'STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION'
NT error statuses seem to be variously DWORD (unsigned) or NTSTATUS
(signed)? So use the one which doesn't cause problems here.
Diff:
---
winsup/cygwin/ntdll.h | 2 +-
winsup/cygwin/pseudo-reloc.cc | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 554e04665..d4f6aaf45 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -18,7 +18,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 ((NTSTATUS) 0xe0000269)
+#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((DWORD) 0xe0000269)
/* Simplify checking for a transactional error code. */
#define NT_TRANSACTIONAL_ERROR(s) \
diff --git a/winsup/cygwin/pseudo-reloc.cc b/winsup/cygwin/pseudo-reloc.cc
index c250fdc01..d015cc5e7 100644
--- a/winsup/cygwin/pseudo-reloc.cc
+++ b/winsup/cygwin/pseudo-reloc.cc
@@ -21,8 +21,6 @@
#else
# include "winsup.h"
# include <sys/cygwin.h>
-/* custom status code: */
-# define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
#endif
#include <stdio.h>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [newlib-cygwin] Cygwin: avoid GCC 10 error with -Werror=narrowing
@ 2020-09-28 13:12 Jon TURNEY
0 siblings, 0 replies; 2+ messages in thread
From: Jon TURNEY @ 2020-09-28 13:12 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=129c9844a6c40d5dee658151c2ff2c461a5a1365
commit 129c9844a6c40d5dee658151c2ff2c461a5a1365
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat Sep 19 15:55:09 2020 +0100
Cygwin: avoid GCC 10 error with -Werror=narrowing
../../../../src/winsup/cygwin/fhandler_console.cc: In member function 'const unsigned char* fhandler_console::write_normal(const unsigned char*, const unsigned char*)':
../../../../src/winsup/cygwin/fhandler_console.cc:2782:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2786:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2836:8: error: narrowing conversion of '-2' from 'int' to 'long unsigned int' [-Wnarrowing]
../../../../src/winsup/cygwin/fhandler_console.cc:2840:8: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing]
A mbtowc_p function returns an int, so that seems the correct type to use here.
Diff:
---
winsup/cygwin/fhandler_console.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 33e40a9f9..41cac37e6 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -2759,7 +2759,7 @@ fhandler_console::write_normal (const unsigned char *src,
DWORD done;
DWORD buf_len;
const unsigned char *found = src;
- size_t ret;
+ int ret;
mbstate_t ps;
mbtowc_p f_mbtowc;
@@ -2938,7 +2938,7 @@ do_print:
{
ret = __utf8_mbtowc (_REENT, NULL, (const char *) found + 1,
end - found - 1, &ps);
- if (ret != (size_t) -1)
+ if (ret != -1)
while (ret-- > 0)
{
WCHAR w = *(found + 1);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-28 13:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 13:12 [newlib-cygwin] Cygwin: avoid GCC 10 error with -Werror=narrowing Jon TURNEY
-- strict thread matches above, loose matches on Subject: below --
2020-09-28 13:12 Jon TURNEY
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).