From: Abramo Bagnara Date: Tue, 28 Dec 2010 17:19:27 +0000 (+0000) Subject: Added scalar casts test. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=927b180b8debfcfd80d36fdec9d0fddba1c283e7;p=clang Added scalar casts test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122599 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Sema/cast.c b/test/Sema/cast.c index e52dcaebbd..71c44b4b81 100644 --- a/test/Sema/cast.c +++ b/test/Sema/cast.c @@ -16,3 +16,144 @@ long bar1(long *next) { return (long)(*next)++; } +typedef _Bool Bool; +typedef int Int; +typedef long Long; +typedef float Float; +typedef double Double; +typedef _Complex int CInt; +typedef _Complex long CLong; +typedef _Complex float CFloat; +typedef _Complex double CDouble; +typedef void *VoidPtr; +typedef char *CharPtr; + +void testBool(Bool v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; + (void) (VoidPtr) v; + (void) (CharPtr) v; +} + +void testInt(Int v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; + (void) (VoidPtr) v; + (void) (CharPtr) v; +} + +void testLong(Long v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; + (void) (VoidPtr) v; + (void) (CharPtr) v; +} + +void testFloat(Float v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testDouble(Double v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testCI(CInt v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testCLong(CLong v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testCFloat(CFloat v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testCDouble(CDouble v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (Float) v; + (void) (Double) v; + (void) (CInt) v; + (void) (CLong) v; + (void) (CFloat) v; + (void) (CDouble) v; +} + +void testVoidPtr(VoidPtr v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (VoidPtr) v; + (void) (CharPtr) v; +} + +void testCharPtr(CharPtr v) { + (void) (Bool) v; + (void) (Int) v; + (void) (Long) v; + (void) (VoidPtr) v; + (void) (CharPtr) v; +}