Skip to content

Commit e952321

Browse files
committed
XSUB.h: fix C23 incompatibility in XSINTERFACE_* macros
In C23, the meaning of an empty function prototype has changed. It used to mean "unspecified number of arguments", but it has now changed to "no arguments". Fixes #23192
1 parent 7946d6a commit e952321

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

XSUB.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,12 @@ is a lexical C<$_> in scope.
188188

189189
#define dXSI32 I32 ix = XSANY.any_i32
190190

191-
#ifdef __cplusplus
191+
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
192192
# define XSINTERFACE_CVT(ret,name) ret (*name)(...)
193193
# define XSINTERFACE_CVT_ANON(ret) ret (*)(...)
194194
#else
195+
/* In C standards before C23, an empty prototype means that the function takes
196+
* an unspecified number of arguments. */
195197
# define XSINTERFACE_CVT(ret,name) ret (*name)()
196198
# define XSINTERFACE_CVT_ANON(ret) ret (*)()
197199
#endif

0 commit comments

Comments
 (0)