Skip to content

Commit 286dfc7

Browse files
build: publish HAS_<Pkg> for detected Synesis packages (#49)
* build: publish HAS_<Pkg> for detected Synesis packages After each successful detection of a Synesis package other than STLSoft, define HAS_<Pkg> and HAS_<PKG>. 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. * 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. * 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.
1 parent 13240bc commit 286dfc7

8 files changed

Lines changed: 140 additions & 22 deletions

File tree

‎CHANGES.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# cstring - Changes <!-- omit in toc -->
22

33

4+
## 4.1.0-beta2 - 27th October 2026
5+
6+
* Defined `HAS_shwild` / `HAS_SHWILD` and `HAS_p99` / `HAS_P99` when those packages are detected;
7+
* 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`;
8+
9+
410
## 4.1.0-beta1 - 21st October 2026
511

612
* 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`;

‎CMakeLists.txt‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Purpose: Top-level CMake lists file for cstring
66
#
77
# Created: 21st December 2023
8-
# Updated: 4th October 2026
8+
# Updated: 27th October 2026
99
#
1010
# ######################################################################## #
1111

@@ -179,9 +179,12 @@ if(BUILD_TESTING)
179179
message("-- CMake package STLSoft found (version ${STLSoft_VERSION}; ${STLSoft_REQUIRED_VERSION_} requested)")
180180
endif()
181181

182-
if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND)
182+
if(DEFINED STLSOFT_INCLUDE_DIR)
183183

184184
include_directories(${STLSOFT_INCLUDE_DIR})
185+
endif()
186+
187+
if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND)
185188

186189
add_compile_definitions(HAS_STLSOFT)
187190
add_compile_definitions(HAS_STLSoft)
@@ -204,7 +207,13 @@ if(BUILD_TESTING)
204207

205208
message("-- CMake package shwild found (version ${shwild_VERSION})")
206209

207-
add_compile_definitions(XTESTS_HAS_SHWILD)
210+
add_compile_definitions(
211+
HAS_shwild
212+
HAS_SHWILD
213+
)
214+
215+
add_compile_definitions(CSTRING_HAS_SHWILD)
216+
add_compile_definitions(XTESTS_HAS_SHWILD) # Legacy form, and should be removed later
208217
endif(shwild_FOUND)
209218
endif(BUILD_TESTING)
210219
endif()
@@ -216,11 +225,16 @@ endif(BUILD_TESTING)
216225

217226
if(BUILD_TESTING)
218227

219-
set(xTests_REQUIRED_VERSION_ 0.26.5)
228+
set(xTests_REQUIRED_VERSION_ 0.28)
220229

221230
find_package(xTests ${xTests_REQUIRED_VERSION_} REQUIRED)
222231

223232
message("-- CMake package xTests found (version ${xTests_VERSION}; ${xTests_REQUIRED_VERSION_} requested)")
233+
234+
add_compile_definitions(
235+
HAS_xTests
236+
HAS_XTESTS
237+
)
224238
endif(BUILD_TESTING)
225239

226240

@@ -236,6 +250,11 @@ if(BUILD_TESTING)
236250
if(p99_FOUND)
237251

238252
message("-- CMake package p99 found (version ${p99_VERSION})")
253+
254+
add_compile_definitions(
255+
HAS_p99
256+
HAS_P99
257+
)
239258
else()
240259

241260
message("-- CMake package p99 not found; performance percentiles and filesystem suites disabled")

‎NEWS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| Date | News Item | Details |
55
| ------------------- | ------------------------------------ | ------- |
66
| Available from [**cstring** project on GitHub](https://synesissoftware.com/cstring): |
7+
| 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` |
78
| 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` |
89
| 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` |
910
| 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 |

‎include/cstring/cstring.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Purpose: Definition of the cstring.core API.
55
*
66
* Created: 16th June 1994
7-
* Updated: 21st October 2026
7+
* Updated: 27th October 2026
88
*
99
* Home: http://synesis.com.au/software/
1010
*
@@ -56,7 +56,7 @@
5656
# define CSTRING_VER_CSTRING_H_CSTRING_MAJOR 3
5757
# define CSTRING_VER_CSTRING_H_CSTRING_MINOR 13
5858
# define CSTRING_VER_CSTRING_H_CSTRING_REVISION 3
59-
# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 103
59+
# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 104
6060
#endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */
6161

6262

@@ -107,6 +107,7 @@
107107
# define CSTRING_VER_4_1_0_A1 0x04010041
108108
# define CSTRING_VER_4_1_0_A2 0x04010042
109109
# define CSTRING_VER_4_1_0_B1 0x04010081
110+
# define CSTRING_VER_4_1_0_B2 0x04010082
110111
#endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */
111112

112113
/** \def CSTRING_VER_MAJOR
@@ -132,7 +133,7 @@
132133
#define CSTRING_VER_MAJOR 4
133134
#define CSTRING_VER_MINOR 1
134135
#define CSTRING_VER_PATCH 0
135-
#define CSTRING_VER_RELSTATUS 0x81
136+
#define CSTRING_VER_RELSTATUS 0x82
136137

137138
#define CSTRING_VER \
138139
(0\
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
11
define_example_program(test.scratch.versions main.c)
2+
3+
if(shwild_FOUND)
4+
5+
target_link_libraries(test.scratch.versions
6+
PRIVATE
7+
shwild::core
8+
)
9+
endif()
10+
11+
if(TARGET xTests::core)
12+
13+
target_link_libraries(test.scratch.versions
14+
PRIVATE
15+
xTests::core
16+
)
17+
endif()
18+
19+
if(TARGET p99::p99)
20+
21+
target_link_libraries(test.scratch.versions
22+
PRIVATE
23+
p99::p99
24+
)
25+
elseif(TARGET p99::p99_static)
26+
27+
target_link_libraries(test.scratch.versions
28+
PRIVATE
29+
p99::p99_static
30+
)
31+
endif()

‎test/scratch/versions/main.c‎

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@
44
* Purpose: Prints cstring composite version (and STLSoft when present).
55
*
66
* Created: 17th September 2026
7-
* Updated: 17th September 2026
7+
* Updated: 27th October 2026
88
*
99
* ////////////////////////////////////////////////////////////////////// */
1010

1111

1212
#include <cstring/cstring.h>
1313

14-
#ifdef HAS_STLSOFT
14+
#ifdef HAS_p99
15+
# include <p99/p99.h>
16+
#endif
17+
18+
#ifdef HAS_shwild
19+
# include <shwild/shwild.h>
20+
#endif
21+
22+
#ifdef HAS_STLSoft
1523
# include <stlsoft/stlsoft.h>
1624
#endif
1725

26+
#ifdef HAS_xTests
27+
# include <xtests/xtests.h>
28+
#endif
29+
1830
#include <stdio.h>
1931
#include <stdlib.h>
2032

@@ -48,6 +60,8 @@ version(
4860

4961
int main(int argc, char* argv[])
5062
{
63+
size_t efferent_counts = 0;
64+
5165
((void)&argc);
5266
((void)&argv);
5367

@@ -57,9 +71,40 @@ int main(int argc, char* argv[])
5771
version(stdout, "", "cstring", "CSTRING_VER", libver);
5872
}
5973

60-
#ifdef HAS_STLSOFT
74+
#ifdef HAS_p99
75+
76+
if (0 == efferent_counts++)
77+
{
78+
fputs("\nefferent dependencies:\n", stdout);
79+
}
80+
81+
{
82+
unsigned const libver = (unsigned)P99_VER;
83+
84+
version(stdout, "\t", "p99", "P99_VER", libver);
85+
}
86+
#endif
87+
88+
#ifdef HAS_shwild
89+
90+
if (0 == efferent_counts++)
91+
{
92+
fputs("\nefferent dependencies:\n", stdout);
93+
}
94+
95+
{
96+
unsigned const libver = (unsigned)SHWILD_VER;
6197

62-
fputs("\nefferent dependencies:\n", stdout);
98+
version(stdout, "\t", "shwild", "SHWILD_VER", libver);
99+
}
100+
#endif
101+
102+
#ifdef HAS_STLSoft
103+
104+
if (0 == efferent_counts++)
105+
{
106+
fputs("\nefferent dependencies:\n", stdout);
107+
}
63108

64109
{
65110
unsigned const libver = (unsigned)_STLSOFT_VER;
@@ -68,6 +113,20 @@ int main(int argc, char* argv[])
68113
}
69114
#endif
70115

116+
#ifdef HAS_xTests
117+
118+
if (0 == efferent_counts++)
119+
{
120+
fputs("\nefferent dependencies:\n", stdout);
121+
}
122+
123+
{
124+
unsigned const libver = (unsigned)_XTESTS_VER;
125+
126+
version(stdout, "\t", "xTests", "_XTESTS_VER", libver);
127+
}
128+
#endif
129+
71130
return EXIT_SUCCESS;
72131
}
73132

‎test/unit/insert-replace/entry.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Purpose: Unit-tests for cstring insert and replace functionality.
55
*
66
* Created: 4th June 2009
7-
* Updated: 5th October 2026
7+
* Updated: 27th October 2026
88
*
99
* ////////////////////////////////////////////////////////////////////// */
1010

@@ -25,10 +25,10 @@
2525

2626
#include "../../cstring_testing.h"
2727

28-
#ifdef XTESTS_HAS_SHWILD
28+
#ifdef CSTRING_HAS_SHWILD
2929
/* shwild header files */
3030
# include <shwild/shwild.h>
31-
#endif /* XTESTS_HAS_SHWILD */
31+
#endif /* CSTRING_HAS_SHWILD */
3232

3333
/* xTests header files */
3434
#include <xtests/terse-api.h>
@@ -141,7 +141,9 @@ static void TEST_cstring_createN(void)
141141
TEST_PTR_NE(NULL, str.ptr);
142142
TEST_INT_GE(str.len, str.capacity);
143143

144-
#if defined(XTESTS_HAS_SHWILD) && !defined(CSTRING_USE_WIDE_STRINGS)
144+
#if 0
145+
#elif defined(CSTRING_HAS_SHWILD) &&\
146+
!defined(CSTRING_USE_WIDE_STRINGS)
145147

146148
/* created string must be entirely '~' */
147149
TEST_MS_DOES_NOT_MATCH("*[a-zA-Z0-9]*", str.ptr);

‎test/unit/status-codes/entry.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Purpose: Unit-tests `cstring_error()`, `cstring_getStatusCodeString()`.
55
*
66
* Created: 28th July 2011
7-
* Updated: 4th October 2026
7+
* Updated: 27th October 2026
88
*
99
* ////////////////////////////////////////////////////////////////////// */
1010

@@ -23,10 +23,10 @@
2323
* general includes
2424
*/
2525

26-
#ifdef XTESTS_HAS_SHWILD
26+
#ifdef CSTRING_HAS_SHWILD
2727
/* shwild header files */
2828
# include <shwild/shwild.h>
29-
#endif /* XTESTS_HAS_SHWILD */
29+
#endif /* CSTRING_HAS_SHWILD */
3030

3131
/* xTests header files */
3232
#include <xtests/terse-api.h>
@@ -149,7 +149,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void)
149149
TEST_MS_NE("<<unknown error>>", cstring_getStatusCodeString(knownCodes[i]));
150150
}}
151151

152-
#ifdef XTESTS_HAS_SHWILD
152+
#ifdef CSTRING_HAS_SHWILD
153153

154154
TEST_MS_MATCHES("operation completed successfully", cstring_getStatusCodeString(CSTRING_RC_SUCCESS));
155155
TEST_MS_MATCHES("out of memory", cstring_getStatusCodeString(CSTRING_RC_OUTOFMEMORY));
@@ -168,7 +168,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void)
168168
TEST_MS_MATCHES("an I/O error occured", cstring_getStatusCodeString(CSTRING_RC_IOERROR));
169169
TEST_MS_MATCHES("system-specific failure occurred", cstring_getStatusCodeString(CSTRING_RC_SYSTEMSPECIFICFAILURE));
170170
TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_getStatusCodeString(CSTRING_RC_REQUESTTOOLARGE));
171-
#endif /* XTESTS_HAS_SHWILD */
171+
#endif /* CSTRING_HAS_SHWILD */
172172
}
173173

174174
static void TEST_cstring_getStatusCodeString_UNKNOWN_CODES(void)
@@ -195,7 +195,7 @@ static void TEST_cstring_error_KNOWN_CODES(void)
195195
TEST_MS_NE("<<unknown error>>", cstring_error(knownCodes[i]));
196196
}}
197197

198-
#ifdef XTESTS_HAS_SHWILD
198+
#ifdef CSTRING_HAS_SHWILD
199199

200200
TEST_MS_MATCHES("operation completed successfully", cstring_error(CSTRING_RC_SUCCESS));
201201
TEST_MS_MATCHES("out of memory", cstring_error(CSTRING_RC_OUTOFMEMORY));
@@ -214,7 +214,7 @@ static void TEST_cstring_error_KNOWN_CODES(void)
214214
TEST_MS_MATCHES("an I/O error occured", cstring_error(CSTRING_RC_IOERROR));
215215
TEST_MS_MATCHES("system-specific failure occurred", cstring_error(CSTRING_RC_SYSTEMSPECIFICFAILURE));
216216
TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_error(CSTRING_RC_REQUESTTOOLARGE));
217-
#endif /* XTESTS_HAS_SHWILD */
217+
#endif /* CSTRING_HAS_SHWILD */
218218
}
219219

220220
static void TEST_cstring_error_UNKNOWN_CODES(void)

0 commit comments

Comments
 (0)