From 411f237f9403c5e79933bae211321933afdaa805 Mon Sep 17 00:00:00 2001 From: woolcoxm <13604288+woolcoxm@users.noreply.github.com> Date: Fri, 17 Jul 2026 08:26:18 -0400 Subject: [PATCH] fix(warnings): silence two -Wall/-Wextra warnings on the MinGW build A clean 'make glm' on MinGW emitted exactly two warnings, both real: 1. compat.h:240 - ignoring pragma comment [-Wunknown-pragmas] #pragma comment(lib, "psapi.lib") is an MSVC directive; MinGW/GCC warns about it. Guarded with ifdef _MSC_VER - MinGW links psapi via -lpsapi (already in the Makefile), MSVC keeps the pragma. 2. glm.c:1210 - g_numa_nodes defined but not used [-Wunused-variable] g_numa_nodes is only read/written inside ifdef __linux__ blocks, so on every non-Linux build it is a static that is never used. Moved the definition under the same __linux__ guard; nothing references it off-Linux. Verified: rm -f *.o glm.exe && make glm -> 0 warnings, 0 errors. --- c/compat.h | 4 +++- c/glm.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/c/compat.h b/c/compat.h index 82de8b6..78b52cb 100644 --- a/c/compat.h +++ b/c/compat.h @@ -237,7 +237,9 @@ static inline int compat_rename(const char *old, const char *new){ /* --- rss_gb: getrusage -> GetProcessMemoryInfo --- * ru_maxrss in KB (come Linux): rss_gb() divide per 1e6 → GB corretti. */ #include -#pragma comment(lib, "psapi.lib") +#ifdef _MSC_VER +#pragma comment(lib, "psapi.lib") /* MSVC: link psapi; MinGW/GCC uses -lpsapi */ +#endif struct rusage { long ru_maxrss; }; #define RUSAGE_SELF 0 static inline int getrusage(int who, struct rusage *r){ diff --git a/c/glm.c b/c/glm.c index 30d970a..40a1690 100644 --- a/c/glm.c +++ b/c/glm.c @@ -1207,7 +1207,9 @@ static int g_disk_split=0; /* DISK_SPLIT=1: contatori che spezzano i DISK LOAD ( * 10x (#82) — hence per-region mbind here and nothing else. Raw syscall, no libnuma * dependency; MPOL_MF_MOVE migrates pages of reused heap chunks too. Linux-only, * silent no-op elsewhere or on single-node hosts. */ -static int g_numa_nodes=0; +#ifdef __linux__ +static int g_numa_nodes=0; /* only touched under __linux__; off-Linux NUMA is a no-op */ +#endif static void numa_slab_bind(void *p, size_t n){ #ifdef __linux__ if(g_numa_nodes<2 || !p || !n) return;