aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-02-22 16:58:11 +0100
committerlemon <lsof@mailbox.org>2026-02-22 16:58:11 +0100
commit8f9f3b4d3c0f86dce85df2aa12196dbb15e716f2 (patch)
tree3689a4728012405f6b88674464ebf6ebd874fb14 /test
parentf99c6a124fe781c9f706c95db0eac38a7706433e (diff)
preprocessor: fix an edge case with erroneously recursive macro expansion
Diffstat (limited to 'test')
-rw-r--r--test/07-pp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/07-pp.c b/test/07-pp.c
index dd179fb..b1afa17 100644
--- a/test/07-pp.c
+++ b/test/07-pp.c
@@ -50,6 +50,18 @@ struct crypto_ex_data_st {
SKM_DEFINE_STACK_OF_INTERNAL(void, void, void)
+char *strchr(const char *, int);
+# define __glibc_const_generic(PTR, CTYPE, CALL) \
+ _Generic (0 ? (PTR) : (void *) 1, \
+ const void *: (CTYPE) (CALL), \
+ default: CALL)
+#define indir(s,c) strchr(s,c)
+#define strchr(S, C) __glibc_const_generic (S, const char *, indir(S, C))
+
+static void f(void) {
+ (void)strchr("",0);
+}
+
#ifdef CMD_WORKING
int
main(V)