xref: /minix3/external/bsd/llvm/dist/clang/test/Headers/c11.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: rm -rf %t
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1
4f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s
5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc noreturn int f(); // expected-error 1+{{}}
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc #include <stdnoreturn.h>
10f4a2713aSLionel Sambuc #include <stdnoreturn.h>
11f4a2713aSLionel Sambuc #include <stdnoreturn.h>
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc int g();
14f4a2713aSLionel Sambuc noreturn int g();
15f4a2713aSLionel Sambuc int noreturn g();
16f4a2713aSLionel Sambuc int g();
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc #include <stdalign.h>
19f4a2713aSLionel Sambuc _Static_assert(__alignas_is_defined, "");
20f4a2713aSLionel Sambuc _Static_assert(__alignof_is_defined, "");
21f4a2713aSLionel Sambuc alignas(alignof(int)) char c[4];
22f4a2713aSLionel Sambuc _Static_assert(__alignof(c) == 4, "");
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc #define __STDC_WANT_LIB_EXT1__ 1
25f4a2713aSLionel Sambuc #include <stddef.h>
26f4a2713aSLionel Sambuc rsize_t x = 0;
2735a4831dSErik van der Kouwe _Static_assert(sizeof(max_align_t) >= sizeof(long long), "");
2835a4831dSErik van der Kouwe _Static_assert(alignof(max_align_t) >= alignof(long long), "");
2935a4831dSErik van der Kouwe _Static_assert(sizeof(max_align_t) >= sizeof(long double), "");
3035a4831dSErik van der Kouwe _Static_assert(alignof(max_align_t) >= alignof(long double), "");
31f4a2713aSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc #ifdef _MSC_VER
33*0a6a1f1dSLionel Sambuc _Static_assert(sizeof(max_align_t) == sizeof(double), "");
34*0a6a1f1dSLionel Sambuc #endif
35*0a6a1f1dSLionel Sambuc 
36f4a2713aSLionel Sambuc // If we are freestanding, then also check RSIZE_MAX (in a hosted implementation
37f4a2713aSLionel Sambuc // we will use the host stdint.h, which may not yet have C11 support).
38f4a2713aSLionel Sambuc #ifndef __STDC_HOSTED__
39f4a2713aSLionel Sambuc #include <stdint.h>
40f4a2713aSLionel Sambuc rsize_t x2 = RSIZE_MAX;
41f4a2713aSLionel Sambuc #endif
42f4a2713aSLionel Sambuc 
43