| 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 |
|
| 9 |
int test_vsscanf(const char *buf, const char *fmt, ...) { |
| 10 |
va_list ap; |
| 11 |
va_start(ap, fmt); |
| 12 |
int ret = vsscanf(buf, fmt, ap); |
| 13 |
va_end(ap); |
| 14 |
return ret; |
| 15 |
} |
| 16 |
|
| 17 |
int 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 |
} |