fix: add explicit STL headers and tighten two non-portable usages#58
Open
iamcheyan wants to merge 1 commit into
Open
fix: add explicit STL headers and tighten two non-portable usages#58iamcheyan wants to merge 1 commit into
iamcheyan wants to merge 1 commit into
Conversation
Apple Clang is stricter than GCC about transitive header inclusion
and a few other corners of the language. None of these changes alter
behavior; they just stop the build from breaking on macOS.
Header completeness (GCC pulled these in transitively):
- common/src/triangle.cpp: <algorithm> for std::max / std::min
- common/src/log.hpp: <unistd.h> for getpid()
- common/src/buffrecord.hpp: <cmath> for std::lround
- common/src/staticvector.hpp: <span> for std::span
- common/src/protocoldef.hpp: <utility> for std::move / std::forward
- client/src/layoutboard.cpp: <ranges> for std::views
Strict-conformance fixes:
- common/src/sdruntimeconfig.hpp: replace `=delete` on a template
specialization with static_assert. Clang requires `=delete` to
appear on the first declaration; the existing usage was a GCC
extension.
- common/src/zcompf.hpp: pass src directly instead of src.data()
-- the parameter is already a raw pointer.
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GCC pulls a few common STL headers in transitively, and accepts a
couple of small non-portable patterns that Clang rejects. Apple
Clang and Clang in general do neither, so the project doesn't
compile out of the box on macOS / on a recent libc++ toolchain.
This PR is the minimal fix. None of these changes affect behaviour
or change Linux GCC builds.
Header completeness (transitive on GCC, not on Clang)
common/src/triangle.cpp—<algorithm>(std::max/std::min)common/src/log.hpp—<unistd.h>(getpid())common/src/buffrecord.hpp—<cmath>(std::lround)common/src/staticvector.hpp—<span>(std::span)common/src/protocoldef.hpp—<utility>(std::move/std::forward)client/src/layoutboard.cpp—<ranges>(std::views)Standards-conformance fixes
common/src/sdruntimeconfig.hpp— replace a=delete-on-template-specialization (a GCC extension) with
static_assert. Clangrequires
=deleteto appear on the first declaration of anentity; the existing form was non-standard.
common/src/zcompf.hpp— passsrcdirectly instead ofsrc.data(); the parameter is already a rawconst uint8_t *,so
.data()doesn't compile.Tested
and replaces non-portable patterns with portable equivalents).