Re: [PATCH 0/3] Warning fixes for gcc 10.2

2020-09-21 Thread Ken Brown via 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


Re: [PATCH v2] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-21 Thread Ken Brown via Cygwin-patches

On 9/21/2020 3:22 PM, Jon Turney wrote:

On 18/09/2020 22:17, Ken Brown via Cygwin-patches wrote:

Do you have to run something to regen the docs, FAQ.html, and push to the web
site, or does it run periodically, so I can follow up to the OP and get feed
back from the responder?


No, sorry.  I don't know how/when that's done.


I believe all the built cygwin documentation files are present in the 
cygwin-htdocs git repo, so updating them in that would deploy to the website.


This is usually only done when a cygwin release is made.


Thanks, that's good to know.

Ken


[PATCH 0/3] Warning fixes for gcc 10.2

2020-09-21 Thread 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



[PATCH 3/3] Cygwin: avoid GCC 10 error with -Werror=narrowing

2020-09-21 Thread 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)0xe001)
 #define STATUS_THREAD_CANCELED ((NTSTATUS)0xe002)
-#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe269)
+#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((DWORD) 0xe269)
 
 /* 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 
-/* custom status code: */
-# define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe269)
 #endif
 
 #include 
-- 
2.28.0



[PATCH 1/3] Cygwin: avoid GCC 10 error with -Werror=parentheses

2020-09-21 Thread 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



[PATCH 2/3] Cygwin: avoid GCC 10 error with -Werror=narrowing

2020-09-21 Thread 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, );
- if (ret != (size_t) -1)
+ if (ret != -1)
while (ret-- > 0)
  {
WCHAR w = *(found + 1);
-- 
2.28.0



Re: [PATCH v2] winsup/doc/faq-what.xml: FAQ 1.2 Windows versions supported

2020-09-21 Thread Jon Turney

On 18/09/2020 22:17, Ken Brown via Cygwin-patches wrote:
Do you have to run something to regen the docs, FAQ.html, and push to 
the web
site, or does it run periodically, so I can follow up to the OP and 
get feed

back from the responder?


No, sorry.  I don't know how/when that's done.


I believe all the built cygwin documentation files are present in the 
cygwin-htdocs git repo, so updating them in that would deploy to the 
website.


This is usually only done when a cygwin release is made.