GCC-only warnings that clang on a Mac hides: missing-declarations, __int128, vector reserve
PitfallVerified 6 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
CI with GCC on x86-64 warns where a clang build on macOS is silent.
Cause#
-Wmissing-declarationsflags every non-static free helper in a test file, in a doctestTEST_SUITE, or in a source file outside an anonymous namespace.__int128triggers-Wpedantic.- GCC gives a false-positive
-Wfree-nonheap-objecton astd::vectorthat callsreserveand thenpush_back.
Fix#
- Mark such helpers
staticor put them in an anonymous namespace. - Declare the type once as
__extension__ typedef __int128 Wide;and useWide. - Build the vector at its final size (
resizeor the sized constructor).
Evidence#
Seen in dftracer-utils CI runs.
Also found by searching
- warning: no previous declaration for function [-Wmissing-declarations]
- GCC warns but clang on Mac does not for test helper functions
- ISO C++ does not support __int128 with -Wpedantic
- -Wfree-nonheap-object false positive std::vector reserve push_back