summaryrefslogtreecommitdiff
path: root/tests/c_files/c11.c
blob: 854feba5f86352fc972940b7da44a2e546a77338 (plain)
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
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <threads.h>
#include <assert.h>

/* C11 thread locals */
_Thread_local int flag;
thread_local int flag2;

static_assert(sizeof(flag) == sizeof(flag2), "Really unexpected size difference");

noreturn void func2(void)
{
  abort();
}

_Noreturn void func(void)
{
  func2();
}

int main()
{
  _Static_assert(sizeof(flag) == sizeof(flag2), "Unexpected size difference");
  static_assert(sizeof(flag) == sizeof(flag2), "Unexpected size difference");

  printf("Flag: %d\n", flag);
  printf("Flag2: %d\n", flag2);
  func();
}