From 1b607d1757d7a7255543b56b9c4bcb302fe2cb56 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 12 Dec 2024 17:02:37 -0500 Subject: [PATCH] deal with some MSYS2 warnings --- src/pline.c | 1 + sys/windows/GNUmakefile | 5 +++-- sys/windows/windsys.c | 30 +++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/pline.c b/src/pline.c index 8163a1d9b..bb9e3c4c0 100644 --- a/src/pline.c +++ b/src/pline.c @@ -665,6 +665,7 @@ execplinehandler(const char *line) args[1] = line; args[2] = NULL; ret = _spawnv(_P_NOWAIT, sysopt.msghandler, args); + nhUse(ret); /* -Wunused-but-set-variable */ } #else use_pline_handler = FALSE; diff --git a/sys/windows/GNUmakefile b/sys/windows/GNUmakefile index bd2d71d2b..be037485a 100644 --- a/sys/windows/GNUmakefile +++ b/sys/windows/GNUmakefile @@ -339,13 +339,14 @@ ifeq "$(GCC_EXTRA_WARNINGS)" "Y" # # These match the warnings enabled on the linux.370 and macOS.370 hints builds # -CFLAGSXTRA = -Wall -Wextra -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow \ +CFLAGSXTRA = -Wall -Wextra -Wreturn-type -Wunused -Wswitch -Wshadow \ -Wwrite-strings -pedantic -Wmissing-declarations \ -Wformat-nonliteral -Wunreachable-code -Wimplicit \ -Wimplicit-function-declaration -Wimplicit-int \ -Wmissing-prototypes -Wold-style-definition \ -Wstrict-prototypes -Wnonnull -Wformat-overflow \ - -Wmissing-parameter-type -Wimplicit-fallthrough + -Wmissing-parameter-type -Wimplicit-fallthrough \ + -Wno-cast-function-type CPPFLAGSXTRA = -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type \ -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -pedantic \ diff --git a/sys/windows/windsys.c b/sys/windows/windsys.c index 5f1a2a5ab..93d7f5f58 100644 --- a/sys/windows/windsys.c +++ b/sys/windows/windsys.c @@ -53,10 +53,11 @@ int redirect_stdout; #ifdef WIN32CON typedef HWND(WINAPI *GETCONSOLEWINDOW)(void); -#ifdef WIN32CON +#if 0 static HWND GetConsoleHandle(void); static HWND GetConsoleHwnd(void); -#endif +#endif /* 0 */ +#endif /* WIN32CON */ #if !defined(TTY_GRAPHICS) extern void backsp(void); #endif @@ -78,7 +79,6 @@ static int max_filename(void); int def_kbhit(void); int (*nt_kbhit)(void) = def_kbhit; -#endif /* WIN32CON */ #ifndef WIN32CON /* this is used as a printf() replacement when the window @@ -92,7 +92,7 @@ VA_DECL(const char *, fmt) VA_END(); return; } -#endif +#endif /* WIN32CON */ char switchar(void) @@ -328,6 +328,7 @@ interject_assistance(int num, int interjection_type, genericptr_t ptr1, genericp } } break; } + nhUse(interjection_type); } void @@ -412,6 +413,7 @@ void port_insert_pastebuf(char *buf) } #ifdef WIN32CON +#if 0 static HWND GetConsoleHandle(void) { @@ -451,8 +453,9 @@ GetConsoleHwnd(void) /* printf("%d iterations\n", iterations); */ return hwndFound; } +#endif /* 0 */ #endif /* WIN32CON */ -#endif +#endif /* RUNTIME_PASTEBUF_SUPPORT */ #ifdef RUNTIME_PORT_ID /* @@ -748,7 +751,7 @@ sys_random_seed(void) time_t datetime = 0; const char *emsg; - if (status == STATUS_NOT_FOUND) + if (status == (NTSTATUS) STATUS_NOT_FOUND) emsg = "BCRYPT_RNG_ALGORITHM not avail, falling back"; else emsg = "Other failure than algorithm not avail"; @@ -796,11 +799,11 @@ struct CRctxt { } ctxp_ = { NULL, NULL, NULL, 0, 0, 0, NULL, 0 }; struct CRctxt *ctxp = &ctxp_; // XXX should this now be in gc.* ? -#define win32err(fn) errname = fn; goto error +#define win32err(fn) errname = (char *) fn; goto error int win32_cr_helper(char cmd, struct CRctxt *contextp, void *p, int d){ - char *errname = "unknown"; + char *errname = (char *) "unknown"; switch (cmd) { default: /* Not panic - we don't want to upgrade an impossible to a @@ -960,8 +963,17 @@ printf("E2: M=%s e=%d\n",msg,errnum); } #endif +#ifdef USE_BACKTRACE +#define USED_IF_BACKTRACE +#else +#define USED_IF_BACKTRACE UNUSED +#endif + int -win32_cr_gettrace(int maxframes, char *out, int outsize){ +win32_cr_gettrace(int maxframes USED_IF_BACKTRACE, + char *out USED_IF_BACKTRACE, + int outsize USED_IF_BACKTRACE) +{ #ifdef USE_BACKTRACE userstate.error_count = 0; userstate.good_count = 0;