c variadic calls

This commit is contained in:
2026-06-14 15:53:45 +02:00
parent 638ca57f5c
commit 2d3d0bd266
21 changed files with 409 additions and 35 deletions
+24
View File
@@ -1,4 +1,6 @@
#include "include/native.h"
#include <stdarg.h>
#include <stdlib.h>
struct Imported_Handle {
int value;
@@ -26,6 +28,28 @@ int imported_read(const Imported_Handle *value) {
return value->value;
}
int imported_variadic(int marker, ...) {
va_list args;
va_start(args, marker);
int narrow_signed = va_arg(args, int);
int narrow_unsigned = va_arg(args, int);
double float_value = va_arg(args, double);
double c_float_value = va_arg(args, double);
const unsigned char *pointer = va_arg(args, const unsigned char *);
const unsigned char *nullable = va_arg(args, const unsigned char *);
va_end(args);
if (!(marker == 7 &&
narrow_signed == -2 &&
narrow_unsigned == 3 &&
float_value == 4.0 &&
c_float_value == 5.0 &&
pointer[0] == 'o' &&
nullable == pointer)) {
abort();
}
return 0;
}
#ifdef BROLANG_FEATURE
int configured_value(int value) {
return value;