Ray's Knowledge Base
Unlock

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-declarations flags every non-static free helper in a test file, in a doctest TEST_SUITE, or in a source file outside an anonymous namespace.
  • __int128 triggers -Wpedantic.
  • GCC gives a false-positive -Wfree-nonheap-object on a std::vector that calls reserve and then push_back.

Fix#

  • Mark such helpers static or put them in an anonymous namespace.
  • Declare the type once as __extension__ typedef __int128 Wide; and use Wide.
  • Build the vector at its final size (resize or 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