Skip to content

fix(warnings): silence two -Wall/-Wextra warnings on the MinGW build#350

Merged
JustVugg merged 1 commit into
JustVugg:devfrom
woolcoxm:fix/build-warnings-dev
Jul 17, 2026
Merged

fix(warnings): silence two -Wall/-Wextra warnings on the MinGW build#350
JustVugg merged 1 commit into
JustVugg:devfrom
woolcoxm:fix/build-warnings-dev

Conversation

@woolcoxm

Copy link
Copy Markdown
Contributor

What

A clean make glm on MinGW emitted exactly two -Wall -Wextra warnings. Both are real; this silences them.

The two warnings

1. compat.h:240ignoring '#pragma comment ' [-Wunknown-pragmas]

#pragma comment(lib, "psapi.lib")

This is an MSVC linker directive. MinGW/GCC doesn't understand it and warns. Guarded with #ifdef _MSC_VER — MinGW already links psapi via -lpsapi (in the Makefile / .build-config), and 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 (numa_slab_bind, numa_init). On every non-Linux build it's a file-scope static that nothing references → unused-variable warning. Moved the definition under the same __linux__ guard:

#ifdef __linux__
static int g_numa_nodes=0;      /* only touched under __linux__; off-Linux NUMA is a no-op */
#endif

Off-Linux numa_slab_bind / numa_init are already full no-ops (they (void) their args and return), so nothing references the variable there.

Verification

rm -f *.o glm.exe && make glm   # 0 warnings, 0 errors, binary builds

Behavior is unchanged on Linux (the variable is identical there) and on MSVC (the pragma is unchanged there).

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.
@JustVugg
JustVugg merged commit 3d0a28b into JustVugg:dev Jul 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants