2014-08-13 00:42:25 +08:00
|
|
|
// RUN: rm -rf %t
|
2013-09-21 05:12:25 +08:00
|
|
|
// RUN: %clang_cc1 -ffreestanding -fsyntax-only -std=c++11 %s
|
2014-08-13 00:42:25 +08:00
|
|
|
// RUN: %clang_cc1 -ffreestanding -fsyntax-only -std=c++11 -fmodules -fmodules-cache-path=%t %s
|
2016-04-16 08:46:26 +08:00
|
|
|
// RUN: %clang_cc1 -ffreestanding -fsyntax-only -std=c++11 -fmodules -fmodules-cache-path=%t -fmodules-local-submodule-visibility %s
|
2013-02-21 10:17:58 +08:00
|
|
|
|
2014-04-20 03:07:19 +08:00
|
|
|
// This test fails on systems with older OS X 10.9 SDK headers, see PR18322.
|
2013-12-25 04:48:13 +08:00
|
|
|
|
2013-02-21 10:17:58 +08:00
|
|
|
#include <stdalign.h>
|
|
|
|
|
|
|
|
#if defined alignas
|
|
|
|
#error alignas should not be defined in C++
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined alignof
|
|
|
|
#error alignof should not be defined in C++
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static_assert(__alignas_is_defined, "");
|
|
|
|
static_assert(__alignof_is_defined, "");
|
tl;dr: Teach Clang to work around g++ changing its workaround to glibc's
implementation of C99's attempt to control the C++ standard. *sigh*
The C99 standard says that certain macros in <stdint.h>, such as SIZE_MAX,
should not be defined when the header is included in C++ mode, unless
__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined. The C++11 standard
says "Thanks, but no thanks" and C11 removed this rule, but various C library
implementations (such as glibc) follow C99 anyway.
g++ prior to 4.8 worked around the C99 / glibc behavior by defining
__STDC_*_MACROS in <cstdint>, which was incorrect, because <stdint.h> is
supposed to provide these macros too. g++ 4.8 works around it by defining
__STDC_*_MACROS in its builtin <stdint.h> header.
This change makes Clang act like g++ 4.8 in this regard: our <stdint.h> now
countermands any attempt by the C library to implement the undesired C99 rules,
by defining the __STDC_*_MACROS first. Unlike g++, we do this even in C++98
mode, since that was the intent of the C++ committee, matches the behavior
required in C11, and matches our built-in implementation of <stdint.h>.
llvm-svn: 179419
2013-04-13 06:11:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#ifndef SIZE_MAX
|
|
|
|
#error SIZE_MAX should be defined in C++
|
|
|
|
#endif
|