Implement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and

WCHAR_MAX in limits.h, thus solving the problem where the system header
thinks it knows better.

llvm-svn: 135455
This commit is contained in:
Alexis Hunt
2011-07-19 00:50:57 +00:00
parent 9ab3cac694
commit 8cb46bb51c
2 changed files with 17 additions and 0 deletions

View File

@@ -554,6 +554,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (!TargetInfo::isTypeSigned(TI.getWIntType()))
Builder.defineMacro("__WINT_UNSIGNED__");
if (!TargetInfo::isTypeSigned(TI.getWCharType()))
Builder.defineMacro("__WCHAR_UNSIGNED__");
// Define exact-width integer types for stdint.h
Builder.defineMacro("__INT" + llvm::Twine(TI.getCharWidth()) + "_TYPE__",
"char");