Uh oh!
There was an error while loading. Please reload this page.
fix(build): make clean remove the test artefacts, and stop hardcoding clang-only flags - #56
Conversation
…ng clang-only flags Two halves of the same trap (#55): `make test CXX=g++` in a directory that had been built with clang did not measure anything, while looking green. 1. `clean` removed `build/*.o` and `build/*.so` but not `build/testobj/` or the `build/test_*` binaries. A compiler switch in the same directory therefore re-ran the PREVIOUS compiler's binaries -- the test output was real, it was just the wrong build's. `clean` now depends on a `clean-test` that removes both (and the `*.d` dependency files alongside the objects). 2. `CXXFLAGS`/`TESTFLAGS` hardcoded `-ferror-limit=1 -ftemplate-backtrace-limit=0`, which are clang spellings; g++ rejects both, so `make CXX=g++` failed on the flags before compiling anything. They now come from a `DIAGFLAGS` chosen by PROBING the compiler (`$(CXX) --version | grep -ci clang`) rather than by pattern-matching `$(CXX)` -- a `g++` that is really AppleClang, or a plain `cc`, both get the right answer. g++ takes `-fmax-errors=1`, which is the direct equivalent; it has no counterpart for the backtrace limit. Verified by doing the thing that used to be impossible: a from-scratch `make clean && make -j4 test CXX=g++`, and the same with `CXX=clang++`, in the same directory, each compiling for real. Closes #55.
d3d10b8 to
eefcba1Comparebalbasty
commented
Aug 1, 2026
Compile counts for the verification above, since "it built" is the claim this PR exists to make checkable. Counted from the full build logs:
and the Worth noting how this bit me while writing the companion PR: my first attempt at Generated by Claude Code |
Agent:
claude-fastfields-to-teenyClosesfastfields/fastfields-lib#131.
Why
Two halves of the same trap.
make test CXX=g++in a directory that had beenbuilt with clang did not measure anything — while looking green. fastfields/fastfields-lib#131 was filed
from #54, where exactly that produced a "both compilers pass" claim that was
not true; the same trap is in the way of every subsequent both-compiler gate,
so it is worth ten lines to remove it rather than working around it again.
What changed
1.
cleannow removes the test artefacts. It removedbuild/*.oandbuild/*.sobut notbuild/testobj/or thebuild/test_*binaries, so acompiler switch in the same directory re-ran the previous compiler's binaries.
The output was real — it was just the wrong build's, which is worse than a
failure.
cleannow depends on aclean-testthat removes both, plus the*.ddependency files next to the objects.
2.
DIAGFLAGSis chosen by probing the compiler.CXXFLAGS/TESTFLAGShardcoded
-ferror-limit=1 -ftemplate-backtrace-limit=0, which are clangspellings; g++ rejects both, so
make CXX=g++failed on the flags beforecompiling a single file. g++ takes
-fmax-errors=1(the direct equivalent) andhas no counterpart for the backtrace limit.
The choice comes from
$(CXX) --version | grep -ci clang, not frompattern-matching
$(CXX): ag++that is really AppleClang, or a plaincc,both then get the right answer.
$(CXX)is only a name.Verification
By doing the thing that used to be impossible — a from-scratch build under each
compiler, in the same directory, each compiling for real:
failures: 0/PASSEDon every line, both compilers. Before this change theg++column could not be produced at all.Build-only change; no source touched.
Generated by Claude Code