Take libakgl 0.7.0, and refuse an over-long type or field name
Some checks failed
akbasic CI Build / cmake_build (push) Failing after 3m6s
akbasic CI Build / sanitizers (push) Failing after 3m59s
akbasic CI Build / coverage (push) Failing after 3m25s
akbasic CI Build / akgl_build (push) Failing after 20s
akbasic CI Build / mutation_test (push) Failing after 3m15s

0.6.0 and 0.7.0 break nothing here: 0.6.0 is three arcade-physics fixes and a
physics.max_timestep property this port does not use, and 0.7.0 reports failures
libakstdlib's wrappers were already catching and takes libakerror 2.0.1 so it
can drop the exit-status trap its own suites needed. That is the same defect
include/akbasic/error.h guards for this band, now fixed at the source rather
than worked around in two places.

The floor moves to 0.7.0 anyway. The soname carries MAJOR.MINOR while the major
is 0, so deciding for ourselves which of libakgl's minor releases were really
compatible is exactly the judgement it exists to take away.

0.7.0 is largely about a defect class worth checking for here rather than
assuming past: ten unterminated strncpy calls into fixed-width name fields. Ours
are clean -- every one is bounded to size - 1 and every buffer is either
explicitly terminated afterwards or memset first, checked site by site. But two
of them, both written last week in src/structtype.c, truncated an over-long name
silently, and truncation is an error everywhere else in this interpreter. It
matters more for a name than for a value: two long type names trimmed to the
same 31 characters collide, and the second is then reported as redeclaring a
type the program never wrote.

Both are refused now, showing the name as written. The check was unreachable as
first drafted, because the prescan read words into a buffer the size of the
limit and so trimmed them before anything could look -- the scratch is twice the
limit now, which is what makes the two cases distinguishable at all.
tests/struct_types.c pins that it stays reachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-01 13:30:35 -04:00
parent c1d06ee4b8
commit 812d846e47
7 changed files with 90 additions and 17 deletions

View File

@@ -36,10 +36,9 @@
#include <akgl/version.h>
/*
* **0.5.0 is a hard floor, API as well as ABI**, which is new: every release
* before it moved this line for ABI reasons alone. 0.5.0 namespaced every
* exported symbol, so the spellings this target compiles against do not exist in
* 0.4.0 and the ones 0.4.0 had do not exist here. `akgl_render_bind2d` is
* **0.5.0 was a hard floor, API as well as ABI**, and it is worth keeping the
* reason: it namespaced every exported symbol, so the spellings this target
* compiles against did not exist before it. `akgl_render_bind2d` is
* `akgl_render_2d_bind`, `akgl_sprite_sheet_coords_for_frame` is
* `akgl_spritesheet_coords_for_frame`, and the `renderer`, `camera` and `window`
* globals carry the prefix -- with `_akgl_renderer` and `_akgl_camera` now
@@ -50,20 +49,27 @@
* same name, the executable's definition preempted the library's, and every
* texture load in that suite failed while the suite reported success.
*
* The soname carries MAJOR.MINOR while the major is 0, so 0.4 and 0.5 are
* **0.6.0 and 0.7.0 broke nothing here**, and the floor moves anyway. 0.6.0 is
* three arcade-physics fixes and a `physics.max_timestep` property this target
* does not use; 0.7.0 reports failures libakstdlib's wrappers were already
* catching, and takes libakerror 2.0.1 so it can drop the exit-status trap its
* own suites needed -- the same defect `include/akbasic/error.h` guards for this
* band, fixed at the source rather than worked around twice.
*
* The soname carries MAJOR.MINOR while the major is 0, so 0.5, 0.6 and 0.7 are
* different ABIs *by declaration* -- libakgl's versioning policy says a 0.x minor
* bump may break, and the soname is built to match. The floor moves with every
* one of them, because the alternative is deciding for ourselves which of
* libakgl's minor releases were really compatible, and that is exactly the
* judgement the soname exists to take away from us.
*
* What it catches is the case the soname cannot: a build against 0.4 headers
* that happens to find a 0.5 library, or the reverse. Refused here rather than
* What it catches is the case the soname cannot: a build against 0.6 headers
* that happens to find a 0.7 library, or the reverse. Refused here rather than
* at link time, because a missing symbol names a function and this names the
* release.
*/
#if !AKGL_VERSION_AT_LEAST(0, 5, 0)
#error "akbasic's libakgl adaptors require libakgl 0.5.0 or later"
#if !AKGL_VERSION_AT_LEAST(0, 7, 0)
#error "akbasic's libakgl adaptors require libakgl 0.7.0 or later"
#endif
#include <akbasic/audio.h>