1// RUN: %clang -std=c17 %s -o %t && %run %t
2/// Test __isoc23_* for glibc 2.38+.
3// RUN: %clang -std=c23 %s -o %t && %run %t
4
5#include <assert.h>
6#include <stdarg.h>
7#include <stdio.h>
8
9int test_vsscanf(const char *buf, const char *fmt, ...) {
10 va_list ap;
11 va_start(ap, fmt);
12 int ret = vsscanf(s: buf, format: fmt, arg: ap);
13 va_end(ap);
14 return ret;
15}
16
17int main(int argc, char **argv) {
18 int x, y;
19 assert(sscanf("42", "%d", &x) == 1);
20 assert(x == 42);
21 assert(test_vsscanf("42", "%d", &y) == 1);
22 assert(y == 42);
23 return 0;
24}
25

source code of compiler-rt/test/sanitizer_common/TestCases/scanf.c