Skip to content

Commit

Permalink
Cygwin: avoid GCC 10 error with -Werror=narrowing
Browse files Browse the repository at this point in the history
../../../../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.
  • Loading branch information
jon-turney authored and lazka committed Nov 8, 2020
1 parent 42babc8 commit e68ccdf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion winsup/cygwin/ntdll.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
2 changes: 0 additions & 2 deletions winsup/cygwin/pseudo-reloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit e68ccdf

Please sign in to comment.