fix(c): macOS build — bump _POSIX_C_SOURCE so <stdio.h> declares snprintf - #14
Merged
Conversation
attic/c/glyph-codec/src/stream_validator.c set _POSIX_C_SOURCE to 199309L for clock_gettime/CLOCK_MONOTONIC. On Darwin that lowers __DARWIN_C_LEVEL below 199506L, which hides <stdio.h>'s snprintf declaration; Apple clang then treats the call at line ~691 as an implicit-declaration error and the macOS C job fails to build. Linux glibc does not hide it, so only `C (macos-latest)` failed (`C (ubuntu-latest)` and the prior commit passed before the runner image bumped). 200809L (POSIX.1-2008) still provides clock_gettime and keeps __DARWIN_C_LEVEL >= 199506L, so snprintf is declared on both platforms. Parked port; lib + 14 C tests build/pass on Linux. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
C (macos-latest)fails to build (C (ubuntu-latest)passes):The file already
#include <stdio.h>, but it first does#define _POSIX_C_SOURCE 199309L(forclock_gettime(CLOCK_MONOTONIC)). On Darwin that lowers__DARWIN_C_LEVELbelow199506L, which hidessnprintfin<stdio.h>; Apple clang then errors on the implicit declaration. Linux glibc doesn't hide it, so only the macOS job failed. (Surfaced when the GitHub macOS runner image updated to a stricter Apple clang.)Fix
Bump to
_POSIX_C_SOURCE 200809L(POSIX.1-2008): still providesclock_gettime, and is ≥199506Lsosnprintfis declared on both Linux and macOS. One-line change in the parked C port; no behavior change.Verification
Linux:
make+make testgreen (lib builds, 14/14 C tests pass). macOS fix is the standard Darwin__DARWIN_C_LEVELremedy.🤖 Generated with Claude Code