Author: efriedma
Date: Tue Aug  3 12:34:19 2010
New Revision: 110126

URL: http://llvm.org/viewvc/llvm-project?rev=110126&view=rev
Log:
PR7795: Fix the definition of __WCHAR_MAX__ with -fshort-wchar.


Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=110126&r1=110125&r2=110126&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Aug  3 12:34:19 2010
@@ -173,7 +173,7 @@
     assert(TypeWidth != 1);
     MaxVal = ~0ULL >> (65-TypeWidth);
   } else
-    MaxVal = ~0LL >> (64-TypeWidth);
+    MaxVal = ~0ULL >> (64-TypeWidth);
 
   Builder.defineMacro(MacroName, llvm::Twine(MaxVal) + ValSuffix);
 }

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=110126&r1=110125&r2=110126&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Aug  3 12:34:19 2010
@@ -117,6 +117,13 @@
 // SCHAR-NOT:#define __UNSIGNED_CHAR__
 // SCHAR:#define __clang__ 1
 //
+// RUN: %clang_cc1 -E -dM -fshort-wchar < /dev/null | FileCheck -check-prefix 
SHORTWCHAR %s
+//
+// SHORTWCHAR: #define __SIZEOF_WCHAR_T__ 2
+// SHORTWCHAR: #define __WCHAR_MAX__ 65535U
+// SHORTWCHAR: #define __WCHAR_TYPE__ unsigned short
+// SHORTWCHAR: #define __WCHAR_WIDTH__ 16
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | 
FileCheck -check-prefix ARM %s
 //
 // ARM:#define __APCS_32__ 1


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to