From 0b950dd18e4a2ac7d051210a0fb40114a35792b2 Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Sat, 1 Aug 2026 22:22:05 -0400 Subject: [PATCH 1/2] cmake: declare target link interfaces explicitly Use modern target_link_libraries scopes so libraries publish their transitive requirements and executables keep theirs private. This preserves schema test linkage with current CMake versions. --- cmake/SC_Targets.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/SC_Targets.cmake b/cmake/SC_Targets.cmake index 8218fad6e..4daa44179 100644 --- a/cmake/SC_Targets.cmake +++ b/cmake/SC_Targets.cmake @@ -22,6 +22,9 @@ macro(SC_ADDEXEC execname) message(SEND_ERROR "SC_ADDEXEC usage error - expected STATIC LINK_LIBRARIES targets (${_lib})") endif() endif() + # Executables consume their dependencies but do not publish an + # interface to downstream targets. + target_link_libraries(${execname} PRIVATE ${_lib}) endforeach() target_link_libraries(${execname} PRIVATE ${${_arg_prefix}_LINK_LIBRARIES}) endif() @@ -74,6 +77,11 @@ macro(SC_ADDLIB _addlib_target) message(SEND_ERROR "SC_ADDLIB usage error - expected (static) LINK_LIBRARIES targets (${_lib})") endif() endif() + # Schema libraries are consumed directly by generated test programs. + # Publish their link requirements explicitly; the legacy unscoped + # signature does not reliably provide a transitive interface with + # current CMake versions. + target_link_libraries(${_addlib_target} PUBLIC ${_lib}) endforeach() target_link_libraries(${_addlib_target} ${_lib}) endif() @@ -93,4 +101,3 @@ endmacro() # indent-tabs-mode: t # End: # ex: shiftwidth=2 tabstop=8 - From 7a19e69532a2c12c011cda94d76142420add238e Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Sat, 1 Aug 2026 21:54:30 -0400 Subject: [PATCH 2/2] express: support modern Lemon allocator callbacks Modern Lemon accepts allocator callbacks with a context parameter. Adapt the standard C allocator functions so generated EXPRESS parsers remain compatible. --- src/express/expparse.y | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/express/expparse.y b/src/express/expparse.y index 635cb9d00..7959f8f96 100644 --- a/src/express/expparse.y +++ b/src/express/expparse.y @@ -1,9 +1,28 @@ /** Lemon grammar for Express parser, based on SCL's expparse.y. */ %include { #include +#include #include "token_type.h" #include "parse_data.h" +/* Wrapper functions for modern lemon compatibility + * Modern lemon from starseeker/lemon uses a 3-parameter signature for memory + * allocation functions: void* realloc(void*, size_t, void*) and void free(void*, void*) + * The third parameter is a context pointer for custom allocators. + * These wrappers adapt the standard C library malloc/free/realloc to this signature + * by ignoring the context parameter. Error handling (NULL checks) is performed by + * the generated lemon code, not in these wrappers. + */ +static void *exp_realloc(void *ptr, size_t size, void *ctx) { + (void)ctx; /* unused - no custom allocator context needed */ + return realloc(ptr, size); +} + +static void exp_free(void *ptr, void *ctx) { + (void)ctx; /* unused - no custom allocator context needed */ + free(ptr); +} + int yyerrstatus = 0; #define yyerrok (yyerrstatus = 0) @@ -120,6 +139,8 @@ void parserInitState( void ) } /* include */ %extra_argument { parse_data_t parseData } +%realloc exp_realloc +%free exp_free %destructor statement_list { if (parseData.scanner == NULL) {