blob: 6594823c273346552a21ef51d7bf0f3a501e6de2 [file] [log] [blame]
Ben Langmuir101390e2014-03-10 23:17:14 +00001// RUN: rm -rf %t
Chandler Carruth2c93cb22013-09-20 21:12:25 +00002// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s
Richard Smithef99e4d2014-10-03 00:31:35 +00003// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1
Chandler Carruth2c93cb22013-09-20 21:12:25 +00004// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s
Saleem Abdulrasoolc68237b2014-07-16 03:13:50 +00005// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s
Richard Smith0015f092013-01-17 22:16:11 +00006
7noreturn int f(); // expected-error 1+{{}}
8
9#include <stdnoreturn.h>
10#include <stdnoreturn.h>
11#include <stdnoreturn.h>
12
13int g();
14noreturn int g();
15int noreturn g();
16int g();
Richard Smith4dab7092013-01-30 06:33:54 +000017
18#include <stdalign.h>
19_Static_assert(__alignas_is_defined, "");
20_Static_assert(__alignof_is_defined, "");
21alignas(alignof(int)) char c[4];
22_Static_assert(__alignof(c) == 4, "");
Daniel Dunbar95f1de32013-04-12 23:24:56 +000023
24#define __STDC_WANT_LIB_EXT1__ 1
25#include <stddef.h>
Daniel Dunbar50b8b552013-04-12 23:41:08 +000026rsize_t x = 0;
Chandler Carruthe8139842014-02-19 22:35:01 +000027_Static_assert(sizeof(max_align_t) >= sizeof(long long), "");
28_Static_assert(alignof(max_align_t) >= alignof(long long), "");
29_Static_assert(sizeof(max_align_t) >= sizeof(long double), "");
30_Static_assert(alignof(max_align_t) >= alignof(long double), "");
Daniel Dunbar50b8b552013-04-12 23:41:08 +000031
David Majnemer1e579762014-03-04 23:43:48 +000032#ifdef _MSC_VER
33_Static_assert(sizeof(max_align_t) == sizeof(double), "");
34#endif
35
Daniel Dunbar50b8b552013-04-12 23:41:08 +000036// If we are freestanding, then also check RSIZE_MAX (in a hosted implementation
37// we will use the host stdint.h, which may not yet have C11 support).
38#ifndef __STDC_HOSTED__
Daniel Dunbar893f3d52013-04-17 21:11:07 +000039#include <stdint.h>
Daniel Dunbar50b8b552013-04-12 23:41:08 +000040rsize_t x2 = RSIZE_MAX;
41#endif
42