diff options
| author | Ed Schouten <ed@80386.nl> | 2013-09-29 07:54:52 +0000 | 
|---|---|---|
| committer | Ed Schouten <ed@80386.nl> | 2013-09-29 07:54:52 +0000 | 
| commit | d062146896ffa711c1f413b002d964eae4c30e4a (patch) | |
| tree | fc473badf0821e6f6b2c99ebcf5bb17db580d587 /clang/lib/Frontend | |
| parent | e75666f47a9aed06c6e82dc009575ad10e68a8c0 (diff) | |
| download | bcm5719-llvm-d062146896ffa711c1f413b002d964eae4c30e4a.tar.gz bcm5719-llvm-d062146896ffa711c1f413b002d964eae4c30e4a.zip  | |
Add character set related __STDC_* definitions.
Clang uses UTF-16 and UTF-32 for its char16_t's and char32_t's
exclusively. This means that we can define __STDC_UTF_16__ and
__STDC_UTF_32__ unconditionally.
While there, define __STDC_MB_MIGHT_NEQ_WC__ for FreeBSD. FreeBSD's
wchar_t's don't encode characters as ISO-10646; the encoding depends on
the locale used. Because the character set used might not be a superset
of ASCII, we must define __STDC_MB_MIGHT_NEQ_WC__.
llvm-svn: 191631
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 8703a67a6f9..77cf3b38e6d 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -330,6 +330,14 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,        Builder.defineMacro("__cplusplus", "199711L");    } +  // In C11 these are environment macros. In C++11 they are only defined +  // as part of <cuchar>. To prevent breakage when mixing C and C++ +  // code, define these macros unconditionally. We can define them +  // unconditionally, as Clang always uses UTF-16 and UTF-32 for 16-bit +  // and 32-bit character literals. +  Builder.defineMacro("__STDC_UTF_16__", "1"); +  Builder.defineMacro("__STDC_UTF_32__", "1"); +    if (LangOpts.ObjC1)      Builder.defineMacro("__OBJC__");  | 

