public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/3] Warning fixes for gcc 10.2
@ 2020-09-21 19:25 Jon Turney
  2020-09-21 19:25 ` [PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses Jon Turney
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jon Turney @ 2020-09-21 19:25 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

Jon Turney (3):
  Cygwin: avoid GCC 10 error with -Werror=parentheses
  Cygwin: avoid GCC 10 error with -Werror=narrowing
  Cygwin: avoid GCC 10 error with -Werror=narrowing

 winsup/cygwin/fhandler_console.cc     | 4 ++--
 winsup/cygwin/fhandler_socket_inet.cc | 2 +-
 winsup/cygwin/ntdll.h                 | 2 +-
 winsup/cygwin/pseudo-reloc.cc         | 2 --
 4 files changed, 4 insertions(+), 6 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses
  2020-09-21 19:25 [PATCH 0/3] Warning fixes for gcc 10.2 Jon Turney
@ 2020-09-21 19:25 ` Jon Turney
  2020-09-21 19:25 ` [PATCH 2/3] Cygwin: avoid GCC 10 error with -Werror=narrowing Jon Turney
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2020-09-21 19:25 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

../../../../src/winsup/cygwin/fhandler_socket_inet.cc: In member function 'ssize_t fhandler_socket_wsock::send_internal(_WSAMSG*, int)':
../../../../src/winsup/cygwin/fhandler_socket_inet.cc:1381:69: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
---
 winsup/cygwin/fhandler_socket_inet.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc
index 2b50671e5..71e92e341 100644
--- a/winsup/cygwin/fhandler_socket_inet.cc
+++ b/winsup/cygwin/fhandler_socket_inet.cc
@@ -1378,7 +1378,7 @@ fhandler_socket_wsock::send_internal (struct _WSAMSG *wsamsg, int flags)
      buffer which only gets partially written. */
   for (DWORD in_idx = 0, in_off = 0;
        in_idx < wsamsg->dwBufferCount;
-       in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, in_off = 0))
+       in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, (in_off = 0)))
     {
       /* Split a message into the least number of pieces to minimize the
 	 number of WsaSendTo calls.  Don't split datagram messages (bad idea).
-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] Cygwin: avoid GCC 10 error with -Werror=narrowing
  2020-09-21 19:25 [PATCH 0/3] Warning fixes for gcc 10.2 Jon Turney
  2020-09-21 19:25 ` [PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses Jon Turney
@ 2020-09-21 19:25 ` Jon Turney
  2020-09-21 19:25 ` [PATCH 3/3] " Jon Turney
  2020-09-21 22:39 ` [PATCH 0/3] Warning fixes for gcc 10.2 Ken Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2020-09-21 19:25 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

../../../../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 funtion returns an int, so that seems the correct type to use here.
---
 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);
-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Cygwin: avoid GCC 10 error with -Werror=narrowing
  2020-09-21 19:25 [PATCH 0/3] Warning fixes for gcc 10.2 Jon Turney
  2020-09-21 19:25 ` [PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses Jon Turney
  2020-09-21 19:25 ` [PATCH 2/3] Cygwin: avoid GCC 10 error with -Werror=narrowing Jon Turney
@ 2020-09-21 19:25 ` Jon Turney
  2020-09-21 22:39 ` [PATCH 0/3] Warning fixes for gcc 10.2 Ken Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2020-09-21 19:25 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

../../../../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.
---
 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 0c6ad13dc..113798e29 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>
-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Warning fixes for gcc 10.2
  2020-09-21 19:25 [PATCH 0/3] Warning fixes for gcc 10.2 Jon Turney
                   ` (2 preceding siblings ...)
  2020-09-21 19:25 ` [PATCH 3/3] " Jon Turney
@ 2020-09-21 22:39 ` Ken Brown
  2020-09-27 18:04   ` Brian Inglis
  3 siblings, 1 reply; 7+ messages in thread
From: Ken Brown @ 2020-09-21 22:39 UTC (permalink / raw)
  To: cygwin-patches

On 9/21/2020 3:25 PM, Jon Turney wrote:
> Jon Turney (3):
>    Cygwin: avoid GCC 10 error with -Werror=parentheses
>    Cygwin: avoid GCC 10 error with -Werror=narrowing
>    Cygwin: avoid GCC 10 error with -Werror=narrowing
> 
>   winsup/cygwin/fhandler_console.cc     | 4 ++--
>   winsup/cygwin/fhandler_socket_inet.cc | 2 +-
>   winsup/cygwin/ntdll.h                 | 2 +-
>   winsup/cygwin/pseudo-reloc.cc         | 2 --
>   4 files changed, 4 insertions(+), 6 deletions(-)

LGTM.

Ken

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Warning fixes for gcc 10.2
  2020-09-21 22:39 ` [PATCH 0/3] Warning fixes for gcc 10.2 Ken Brown
@ 2020-09-27 18:04   ` Brian Inglis
  2020-09-30  3:30     ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2020-09-27 18:04 UTC (permalink / raw)
  To: cygwin-patches

On 2020-09-21 16:39, Ken Brown via Cygwin-patches wrote:
> On 9/21/2020 3:25 PM, Jon Turney wrote:
>> Jon Turney (3):
>>    Cygwin: avoid GCC 10 error with -Werror=parentheses
>>    Cygwin: avoid GCC 10 error with -Werror=narrowing
>>    Cygwin: avoid GCC 10 error with -Werror=narrowing
>>
>>   winsup/cygwin/fhandler_console.cc     | 4 ++--
>>   winsup/cygwin/fhandler_socket_inet.cc | 2 +-
>>   winsup/cygwin/ntdll.h                 | 2 +-
>>   winsup/cygwin/pseudo-reloc.cc         | 2 --
>>   4 files changed, 4 insertions(+), 6 deletions(-)
> 
> LGTM.
> 
> Ken

Same or better than what I came up with, before I came on here to post, and saw
you had already dealt with those! ++PUSH

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Warning fixes for gcc 10.2
  2020-09-27 18:04   ` Brian Inglis
@ 2020-09-30  3:30     ` Brian Inglis
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Inglis @ 2020-09-30  3:30 UTC (permalink / raw)
  To: cygwin-patches

After pulling the error fixes, rm **/config.cache, and re-making, I got some
funny results while rebuilding cygwin32 only.
Some previously built object files were no longer recognized as such, and halted
the build; even file showed them as generic "data".
This persisted even after rm **/config.cache, plus those object files not
showing as "Intel 80386 COFF object file", and redoing ./configure && make.
Only after doing "make distclean", rm **/config.cache, ./configure && make, did
the build complete normally.
Any ideas what the issue might have been, and best practices for rebuilding
cygwin after tool updates?

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-30  3:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 19:25 [PATCH 0/3] Warning fixes for gcc 10.2 Jon Turney
2020-09-21 19:25 ` [PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses Jon Turney
2020-09-21 19:25 ` [PATCH 2/3] Cygwin: avoid GCC 10 error with -Werror=narrowing Jon Turney
2020-09-21 19:25 ` [PATCH 3/3] " Jon Turney
2020-09-21 22:39 ` [PATCH 0/3] Warning fixes for gcc 10.2 Ken Brown
2020-09-27 18:04   ` Brian Inglis
2020-09-30  3:30     ` Brian Inglis

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).