From 272e1c86128563012fe044461de4b94711d22b8f Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Tue, 27 Oct 2026 11:36:18 +1100 Subject: [PATCH 1/3] build: publish HAS_ for detected Synesis packages After each successful detection of a Synesis package other than STLSoft, define HAS_ and HAS_. Dots in package names become underscores. BDUT and CLASP, already all-caps, get the single macro. Client-prefixed presence macros were removed where only the client read them. Dependency switches such as XTESTS_HAS_SHWILD, PANTHEIOS_HAS_SHWILD, and the *_NO_* contracts stay. --- CHANGES.md | 6 +++++ CMakeLists.txt | 22 +++++++++++++++--- NEWS.md | 1 + include/cstring/cstring.h | 7 +++--- test/scratch/versions/main.c | 38 +++++++++++++++++++++++++++++--- test/unit/insert-replace/entry.c | 10 +++++---- test/unit/status-codes/entry.c | 14 ++++++------ 7 files changed, 78 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9d5cc63..d58c63a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ # cstring - Changes +## 4.1.0-beta2 - 27th October 2026 + +* Defined `HAS_shwild` / `HAS_SHWILD` and `HAS_p99` / `HAS_P99` when those packages are detected; +* Unit tests **test.unit.insert-replace** and **test.unit.status-codes** include **shwild** under `CSTRING_HAS_SHWILD`, and **test.scratch.versions** prints **shwild** under `HAS_shwild`; + + ## 4.1.0-beta1 - 21st October 2026 * Brought the tip CMake runners up to **misc-dev-scripts** 0.6.2 and merged that gold into **prepare_cmake.sh**, keeping the cstring `-D` flags and `--gap-groups`; diff --git a/CMakeLists.txt b/CMakeLists.txt index daa79db..f882fd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # Purpose: Top-level CMake lists file for cstring # # Created: 21st December 2023 -# Updated: 4th October 2026 +# Updated: 27th October 2026 # # ######################################################################## # @@ -204,7 +204,13 @@ if(BUILD_TESTING) message("-- CMake package shwild found (version ${shwild_VERSION})") - add_compile_definitions(XTESTS_HAS_SHWILD) + add_compile_definitions( + HAS_shwild + HAS_SHWILD + ) + + add_compile_definitions(CSTRING_HAS_SHWILD) + add_compile_definitions(XTESTS_HAS_SHWILD) # Legacy form, and should be removed later endif(shwild_FOUND) endif(BUILD_TESTING) endif() @@ -216,11 +222,16 @@ endif(BUILD_TESTING) if(BUILD_TESTING) - set(xTests_REQUIRED_VERSION_ 0.26.5) + set(xTests_REQUIRED_VERSION_ 0.28) find_package(xTests ${xTests_REQUIRED_VERSION_} REQUIRED) message("-- CMake package xTests found (version ${xTests_VERSION}; ${xTests_REQUIRED_VERSION_} requested)") + + add_compile_definitions( + HAS_xTests + HAS_XTESTS + ) endif(BUILD_TESTING) @@ -236,6 +247,11 @@ if(BUILD_TESTING) if(p99_FOUND) message("-- CMake package p99 found (version ${p99_VERSION})") + + add_compile_definitions( + HAS_p99 + HAS_P99 + ) else() message("-- CMake package p99 not found; performance percentiles and filesystem suites disabled") diff --git a/NEWS.md b/NEWS.md index ab05082..c29b560 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ | Date | News Item | Details | | ------------------- | ------------------------------------ | ------- | | Available from [**cstring** project on GitHub](https://synesissoftware.com/cstring): | +| 27th October 2026 | Release of [cstring 4.1.0-beta2](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-beta2) | `HAS_shwild` / `HAS_p99`; tests use `CSTRING_HAS_SHWILD` | | 21st October 2026 | Release of [cstring 4.1.0-beta1](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-beta1) | helper gold 0.6.2; `CSTRING_VER_RELSTATUS` | | 6th October 2026 | Release of [cstring 4.1.0-alpha1](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-alpha1) | `djb2`, `FNV-1a`, and `SDBM`; `cstring_equal()` / `cstring_compare()`; `--wide-strings`; counted copies stop at `cch` | | 4th October 2026 | Release of [cstring 4.0.19](https://github.com/synesissoftware/cstring/releases/tag/4.0.19) | lone CR ends a line; `numRead` includes EOL; readonly truncate; zero-size realloc frees; **test.performance.cstring_readline**; shortened test and example directories; **test.unit.cstring**; README usage modes | diff --git a/include/cstring/cstring.h b/include/cstring/cstring.h index bff5fa8..8296e70 100644 --- a/include/cstring/cstring.h +++ b/include/cstring/cstring.h @@ -4,7 +4,7 @@ * Purpose: Definition of the cstring.core API. * * Created: 16th June 1994 - * Updated: 21st October 2026 + * Updated: 27th October 2026 * * Home: http://synesis.com.au/software/ * @@ -56,7 +56,7 @@ # define CSTRING_VER_CSTRING_H_CSTRING_MAJOR 3 # define CSTRING_VER_CSTRING_H_CSTRING_MINOR 13 # define CSTRING_VER_CSTRING_H_CSTRING_REVISION 3 -# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 103 +# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 104 #endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */ @@ -107,6 +107,7 @@ # define CSTRING_VER_4_1_0_A1 0x04010041 # define CSTRING_VER_4_1_0_A2 0x04010042 # define CSTRING_VER_4_1_0_B1 0x04010081 +# define CSTRING_VER_4_1_0_B2 0x04010082 #endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */ /** \def CSTRING_VER_MAJOR @@ -132,7 +133,7 @@ #define CSTRING_VER_MAJOR 4 #define CSTRING_VER_MINOR 1 #define CSTRING_VER_PATCH 0 -#define CSTRING_VER_RELSTATUS 0x81 +#define CSTRING_VER_RELSTATUS 0x82 #define CSTRING_VER \ (0\ diff --git a/test/scratch/versions/main.c b/test/scratch/versions/main.c index fa6cd1c..69e9b93 100644 --- a/test/scratch/versions/main.c +++ b/test/scratch/versions/main.c @@ -4,17 +4,25 @@ * Purpose: Prints cstring composite version (and STLSoft when present). * * Created: 17th September 2026 - * Updated: 17th September 2026 + * Updated: 27th October 2026 * * ////////////////////////////////////////////////////////////////////// */ #include -#ifdef HAS_STLSOFT +#ifdef HAS_shwild +# include +#endif + +#ifdef HAS_STLSoft # include #endif +#ifdef HAS_xTests +# include +#endif + #include #include @@ -48,6 +56,8 @@ version( int main(int argc, char* argv[]) { + size_t efferent_counts = 0; + ((void)&argc); ((void)&argv); @@ -57,9 +67,20 @@ int main(int argc, char* argv[]) version(stdout, "", "cstring", "CSTRING_VER", libver); } +#ifdef HAS_shwild + + (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + + { + unsigned const libver = (unsigned)SHWILD_VER; + + version(stdout, "\t", "shwild", "SHWILD_VER", libver); + } +#endif + #ifdef HAS_STLSOFT - fputs("\nefferent dependencies:\n", stdout); + (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); { unsigned const libver = (unsigned)_STLSOFT_VER; @@ -68,6 +89,17 @@ int main(int argc, char* argv[]) } #endif +#ifdef HAS_xTests + + (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + + { + unsigned const libver = (unsigned)_XTESTS_VER; + + version(stdout, "\t", "xTests", "_XTESTS_VER", libver); + } +#endif + return EXIT_SUCCESS; } diff --git a/test/unit/insert-replace/entry.c b/test/unit/insert-replace/entry.c index 0985be5..16f66f2 100644 --- a/test/unit/insert-replace/entry.c +++ b/test/unit/insert-replace/entry.c @@ -4,7 +4,7 @@ * Purpose: Unit-tests for cstring insert and replace functionality. * * Created: 4th June 2009 - * Updated: 5th October 2026 + * Updated: 27th October 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -25,10 +25,10 @@ #include "../../cstring_testing.h" -#ifdef XTESTS_HAS_SHWILD +#ifdef CSTRING_HAS_SHWILD /* shwild header files */ # include -#endif /* XTESTS_HAS_SHWILD */ +#endif /* CSTRING_HAS_SHWILD */ /* xTests header files */ #include @@ -141,7 +141,9 @@ static void TEST_cstring_createN(void) TEST_PTR_NE(NULL, str.ptr); TEST_INT_GE(str.len, str.capacity); -#if defined(XTESTS_HAS_SHWILD) && !defined(CSTRING_USE_WIDE_STRINGS) +#if 0 +#elif defined(CSTRING_HAS_SHWILD) &&\ + !defined(CSTRING_USE_WIDE_STRINGS) /* created string must be entirely '~' */ TEST_MS_DOES_NOT_MATCH("*[a-zA-Z0-9]*", str.ptr); diff --git a/test/unit/status-codes/entry.c b/test/unit/status-codes/entry.c index bb457be..e8e0b78 100644 --- a/test/unit/status-codes/entry.c +++ b/test/unit/status-codes/entry.c @@ -4,7 +4,7 @@ * Purpose: Unit-tests `cstring_error()`, `cstring_getStatusCodeString()`. * * Created: 28th July 2011 - * Updated: 4th October 2026 + * Updated: 27th October 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -23,10 +23,10 @@ * general includes */ -#ifdef XTESTS_HAS_SHWILD +#ifdef CSTRING_HAS_SHWILD /* shwild header files */ # include -#endif /* XTESTS_HAS_SHWILD */ +#endif /* CSTRING_HAS_SHWILD */ /* xTests header files */ #include @@ -149,7 +149,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void) TEST_MS_NE("<>", cstring_getStatusCodeString(knownCodes[i])); }} -#ifdef XTESTS_HAS_SHWILD +#ifdef CSTRING_HAS_SHWILD TEST_MS_MATCHES("operation completed successfully", cstring_getStatusCodeString(CSTRING_RC_SUCCESS)); TEST_MS_MATCHES("out of memory", cstring_getStatusCodeString(CSTRING_RC_OUTOFMEMORY)); @@ -168,7 +168,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void) TEST_MS_MATCHES("an I/O error occured", cstring_getStatusCodeString(CSTRING_RC_IOERROR)); TEST_MS_MATCHES("system-specific failure occurred", cstring_getStatusCodeString(CSTRING_RC_SYSTEMSPECIFICFAILURE)); TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_getStatusCodeString(CSTRING_RC_REQUESTTOOLARGE)); -#endif /* XTESTS_HAS_SHWILD */ +#endif /* CSTRING_HAS_SHWILD */ } static void TEST_cstring_getStatusCodeString_UNKNOWN_CODES(void) @@ -195,7 +195,7 @@ static void TEST_cstring_error_KNOWN_CODES(void) TEST_MS_NE("<>", cstring_error(knownCodes[i])); }} -#ifdef XTESTS_HAS_SHWILD +#ifdef CSTRING_HAS_SHWILD TEST_MS_MATCHES("operation completed successfully", cstring_error(CSTRING_RC_SUCCESS)); TEST_MS_MATCHES("out of memory", cstring_error(CSTRING_RC_OUTOFMEMORY)); @@ -214,7 +214,7 @@ static void TEST_cstring_error_KNOWN_CODES(void) TEST_MS_MATCHES("an I/O error occured", cstring_error(CSTRING_RC_IOERROR)); TEST_MS_MATCHES("system-specific failure occurred", cstring_error(CSTRING_RC_SYSTEMSPECIFICFAILURE)); TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_error(CSTRING_RC_REQUESTTOOLARGE)); -#endif /* XTESTS_HAS_SHWILD */ +#endif /* CSTRING_HAS_SHWILD */ } static void TEST_cstring_error_UNKNOWN_CODES(void) From 85ad2209f220b33577812b23982971a52f8380c4 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Tue, 27 Oct 2026 12:38:55 +1100 Subject: [PATCH 2/3] fix: align versions links and current release symbols Keep versions target_link_libraries in the signature the project already uses, link header-only packages by their imported target, and compare version tests with the current release symbol. --- CMakeLists.txt | 5 ++++- test/scratch/versions/CMakeLists.txt | 30 ++++++++++++++++++++++++++++ test/scratch/versions/main.c | 17 +++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f882fd7..0ca86f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,9 +179,12 @@ if(BUILD_TESTING) message("-- CMake package STLSoft found (version ${STLSoft_VERSION}; ${STLSoft_REQUIRED_VERSION_} requested)") endif() - if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND) + if(DEFINED STLSOFT_INCLUDE_DIR) include_directories(${STLSOFT_INCLUDE_DIR}) + endif() + + if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND) add_compile_definitions(HAS_STLSOFT) add_compile_definitions(HAS_STLSoft) diff --git a/test/scratch/versions/CMakeLists.txt b/test/scratch/versions/CMakeLists.txt index 5b5ed67..5eb9cb3 100644 --- a/test/scratch/versions/CMakeLists.txt +++ b/test/scratch/versions/CMakeLists.txt @@ -1 +1,31 @@ define_example_program(test.scratch.versions main.c) + +if(shwild_FOUND) + + target_link_libraries(test.scratch.versions + PRIVATE + shwild::core + ) +endif() + +if(TARGET xTests::core) + + target_link_libraries(test.scratch.versions + PRIVATE + xTests::core + ) +endif() + +if(TARGET p99::p99) + + target_link_libraries(test.scratch.versions + PRIVATE + p99::p99 + ) +elseif(TARGET p99::p99_static) + + target_link_libraries(test.scratch.versions + PRIVATE + p99::p99_static + ) +endif() diff --git a/test/scratch/versions/main.c b/test/scratch/versions/main.c index 69e9b93..1db6327 100644 --- a/test/scratch/versions/main.c +++ b/test/scratch/versions/main.c @@ -11,6 +11,10 @@ #include +#ifdef HAS_p99 +# include +#endif + #ifdef HAS_shwild # include #endif @@ -67,6 +71,17 @@ int main(int argc, char* argv[]) version(stdout, "", "cstring", "CSTRING_VER", libver); } +#ifdef HAS_p99 + + (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + + { + unsigned const libver = (unsigned)P99_VER; + + version(stdout, "\t", "p99", "P99_VER", libver); + } +#endif + #ifdef HAS_shwild (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); @@ -78,7 +93,7 @@ int main(int argc, char* argv[]) } #endif -#ifdef HAS_STLSOFT +#ifdef HAS_STLSoft (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); From 658d61f634f79372294bd11507dedd79badc82e3 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Tue, 27 Oct 2026 19:06:15 +1100 Subject: [PATCH 3/3] fix: use an if for C versions efferent headings The && fputs heading expression trips -Werror=unused-value. Print the heading from an if, as the C++ reporters already do. --- test/scratch/versions/main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/scratch/versions/main.c b/test/scratch/versions/main.c index 1db6327..e6070bc 100644 --- a/test/scratch/versions/main.c +++ b/test/scratch/versions/main.c @@ -73,7 +73,10 @@ int main(int argc, char* argv[]) #ifdef HAS_p99 - (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + if (0 == efferent_counts++) + { + fputs("\nefferent dependencies:\n", stdout); + } { unsigned const libver = (unsigned)P99_VER; @@ -84,7 +87,10 @@ int main(int argc, char* argv[]) #ifdef HAS_shwild - (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + if (0 == efferent_counts++) + { + fputs("\nefferent dependencies:\n", stdout); + } { unsigned const libver = (unsigned)SHWILD_VER; @@ -95,7 +101,10 @@ int main(int argc, char* argv[]) #ifdef HAS_STLSoft - (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + if (0 == efferent_counts++) + { + fputs("\nefferent dependencies:\n", stdout); + } { unsigned const libver = (unsigned)_STLSOFT_VER; @@ -106,7 +115,10 @@ int main(int argc, char* argv[]) #ifdef HAS_xTests - (0 == efferent_counts++) && fputs("\nefferent dependencies:\n", stdout); + if (0 == efferent_counts++) + { + fputs("\nefferent dependencies:\n", stdout); + } { unsigned const libver = (unsigned)_XTESTS_VER;