File: function4.c

package info (click to toggle)
chibicc 1.0.23.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,832 kB
  • sloc: ansic: 62,911; sh: 275; makefile: 92
file content (32 lines) | stat: -rw-r--r-- 636 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <stdarg.h>
#include "test.h"

typedef struct {
  char _Alignas(1024) c;
} Aligned1024;

void test_va_args(const char *label, int n, ...) {
  va_list ap;
  va_start(ap, n);

  long double ld = va_arg(ap, long double);
  Aligned1024 *a = va_arg(ap, Aligned1024 *);
  int i = va_arg(ap, int);

  printf("%s:\n", label);
  printf("long double = %Lf\n", ld);
  printf("Aligned1024->c = %d\n", a->c);
  printf("int = %d\n", i);
  ASSERT(77, a->c);

  va_end(ap);
}

int main(void) {
  long double ld = 3.1415926535897932384626L;
  Aligned1024 a = {.c = 77};

  test_va_args("Test2", 3, ld, &a, 123);
  return 0;
}