From 9c3b1bcb858ed76ea0bf8e5b862de4b63013706a Mon Sep 17 00:00:00 2001 From: jsm28 Date: Wed, 8 Apr 2009 21:02:17 +0000 Subject: * gcc.dg/c99-stdint-1.c: Fix cut-and-paste mistakes in test. * gcc.dg/c99-stdint-7.c, gcc.dg/c99-stdint-8.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/gcc.dg/c99-stdint-1.c | 12 +- gcc/testsuite/gcc.dg/c99-stdint-7.c | 217 ++++++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/c99-stdint-8.c | 9 ++ 4 files changed, 237 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/c99-stdint-7.c create mode 100644 gcc/testsuite/gcc.dg/c99-stdint-8.c (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d843ba29786..7808aa5724a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-08 Joseph Myers + + * gcc.dg/c99-stdint-1.c: Fix cut-and-paste mistakes in test. + * gcc.dg/c99-stdint-7.c, gcc.dg/c99-stdint-8.c: New tests. + 2009-04-08 Jakub Jelinek * g++.dg/debug/dwarf2/static-data-member1.C: New test. diff --git a/gcc/testsuite/gcc.dg/c99-stdint-1.c b/gcc/testsuite/gcc.dg/c99-stdint-1.c index 5dcac41276e..109aed4d284 100644 --- a/gcc/testsuite/gcc.dg/c99-stdint-1.c +++ b/gcc/testsuite/gcc.dg/c99-stdint-1.c @@ -89,19 +89,19 @@ test_exact (void) CHECK_WIDTH_EQUALS(int16_t, 16); CHECK_SIGNED_LIMITS(int16_t, INT16_MIN, INT16_MAX); #else - CHECK_WIDTH_AT_LEAST(int_least8_t, 17); + CHECK_WIDTH_AT_LEAST(int_least16_t, 17); #endif #ifdef INT32_MIN CHECK_WIDTH_EQUALS(int32_t, 32); CHECK_SIGNED_LIMITS(int32_t, INT32_MIN, INT32_MAX); #else - CHECK_WIDTH_AT_LEAST(int_least8_t, 33); + CHECK_WIDTH_AT_LEAST(int_least32_t, 33); #endif #ifdef INT64_MIN CHECK_WIDTH_EQUALS(int64_t, 64); CHECK_SIGNED_LIMITS(int64_t, INT64_MIN, INT64_MAX); #else - CHECK_WIDTH_AT_LEAST(int_least8_t, 65); + CHECK_WIDTH_AT_LEAST(int_least64_t, 65); #endif #ifdef UINT8_MAX CHECK_WIDTH_EQUALS(uint8_t, 8); @@ -113,19 +113,19 @@ test_exact (void) CHECK_WIDTH_EQUALS(uint16_t, 16); CHECK_UNSIGNED_LIMITS(uint16_t, UINT16_MAX); #else - CHECK_WIDTH_AT_LEAST(uint_least8_t, 17); + CHECK_WIDTH_AT_LEAST(uint_least16_t, 17); #endif #ifdef UINT32_MAX CHECK_WIDTH_EQUALS(uint32_t, 32); CHECK_UNSIGNED_LIMITS(uint32_t, UINT32_MAX); #else - CHECK_WIDTH_AT_LEAST(uint_least8_t, 33); + CHECK_WIDTH_AT_LEAST(uint_least32_t, 33); #endif #ifdef UINT64_MAX CHECK_WIDTH_EQUALS(uint64_t, 64); CHECK_UNSIGNED_LIMITS(uint64_t, UINT64_MAX); #else - CHECK_WIDTH_AT_LEAST(uint_least8_t, 65); + CHECK_WIDTH_AT_LEAST(uint_least64_t, 65); #endif } diff --git a/gcc/testsuite/gcc.dg/c99-stdint-7.c b/gcc/testsuite/gcc.dg/c99-stdint-7.c new file mode 100644 index 00000000000..777e895b506 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-7.c @@ -0,0 +1,217 @@ +/* Verify that the limits defined in are those GCC expects + internally to be defined and that they are usable in #if + conditions. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -fhosted" } */ + +#include + +/* Exact-width and pointer-holding types are optional. */ +#if defined(INT8_MIN) != defined(__INT8_TYPE__) +#error "Unexpected INT8_MIN definedness" +#endif +#if defined(INT8_MAX) != defined(__INT8_TYPE__) +#error "Unexpected INT8_MAX definedness" +#endif +#if defined(UINT8_MAX) != defined(__UINT8_TYPE__) +#error "Unexpected UINT8_MAX definedness" +#endif +#if defined(INT16_MIN) != defined(__INT16_TYPE__) +#error "Unexpected INT16_MIN definedness" +#endif +#if defined(INT16_MAX) != defined(__INT16_TYPE__) +#error "Unexpected INT16_MAX definedness" +#endif +#if defined(UINT16_MAX) != defined(__UINT16_TYPE__) +#error "Unexpected UINT16_MAX definedness" +#endif +#if defined(INT32_MIN) != defined(__INT32_TYPE__) +#error "Unexpected INT32_MIN definedness" +#endif +#if defined(INT32_MAX) != defined(__INT32_TYPE__) +#error "Unexpected INT32_MAX definedness" +#endif +#if defined(UINT32_MAX) != defined(__UINT32_TYPE__) +#error "Unexpected UINT32_MAX definedness" +#endif +#if defined(INT64_MIN) != defined(__INT64_TYPE__) +#error "Unexpected INT64_MIN definedness" +#endif +#if defined(INT64_MAX) != defined(__INT64_TYPE__) +#error "Unexpected INT64_MAX definedness" +#endif +#if defined(UINT64_MAX) != defined(__UINT64_TYPE__) +#error "Unexpected UINT64_MAX definedness" +#endif +#if defined(INTPTR_MIN) != defined(__INTPTR_TYPE__) +#error "Unexpected INTPTR_MIN definedness" +#endif +#if defined(INTPTR_MAX) != defined(__INTPTR_TYPE__) +#error "Unexpected INTPTR_MAX definedness" +#endif +#if defined(UINTPTR_MAX) != defined(__UINTPTR_TYPE__) +#error "Unexpected UINTPTR_MAX definedness" +#endif + +#if defined(INT8_MIN) && INT8_MIN != -__INT8_MAX__-1 +#error "INT8_MIN not usable in #if or wrong value" +#endif +#if defined(INT8_MAX) && INT8_MAX != __INT8_MAX__ +#error "INT8_MAX not usable in #if or wrong value" +#endif +#if defined(UINT8_MAX) && UINT8_MAX != __UINT8_MAX__ +#error "UINT8_MAX not usable in #if or wrong value" +#endif +#if defined(INT16_MIN) && INT16_MIN != -__INT16_MAX__-1 +#error "INT16_MIN not usable in #if or wrong value" +#endif +#if defined(INT16_MAX) && INT16_MAX != __INT16_MAX__ +#error "INT16_MAX not usable in #if or wrong value" +#endif +#if defined(UINT16_MAX) && UINT16_MAX != __UINT16_MAX__ +#error "UINT16_MAX not usable in #if or wrong value" +#endif +#if defined(INT32_MIN) && INT32_MIN != -__INT32_MAX__-1 +#error "INT32_MIN not usable in #if or wrong value" +#endif +#if defined(INT32_MAX) && INT32_MAX != __INT32_MAX__ +#error "INT32_MAX not usable in #if or wrong value" +#endif +#if defined(UINT32_MAX) && UINT32_MAX != __UINT32_MAX__ +#error "UINT32_MAX not usable in #if or wrong value" +#endif +#if defined(INT64_MIN) && INT64_MIN != -__INT64_MAX__-1 +#error "INT64_MIN not usable in #if or wrong value" +#endif +#if defined(INT64_MAX) && INT64_MAX != __INT64_MAX__ +#error "INT64_MAX not usable in #if or wrong value" +#endif +#if defined(UINT64_MAX) && UINT64_MAX != __UINT64_MAX__ +#error "UINT64_MAX not usable in #if or wrong value" +#endif + +#if INT_LEAST8_MIN != -__INT_LEAST8_MAX__-1 +#error "INT_LEAST8_MIN not usable in #if or wrong value" +#endif +#if INT_LEAST8_MAX != __INT_LEAST8_MAX__ +#error "INT_LEAST8_MAX not usable in #if or wrong value" +#endif +#if UINT_LEAST8_MAX != __UINT_LEAST8_MAX__ +#error "UINT_LEAST8_MAX not usable in #if or wrong value" +#endif +#if INT_LEAST16_MIN != -__INT_LEAST16_MAX__-1 +#error "INT_LEAST16_MIN not usable in #if or wrong value" +#endif +#if INT_LEAST16_MAX != __INT_LEAST16_MAX__ +#error "INT_LEAST16_MAX not usable in #if or wrong value" +#endif +#if UINT_LEAST16_MAX != __UINT_LEAST16_MAX__ +#error "UINT_LEAST16_MAX not usable in #if or wrong value" +#endif +#if INT_LEAST32_MIN != -__INT_LEAST32_MAX__-1 +#error "INT_LEAST32_MIN not usable in #if or wrong value" +#endif +#if INT_LEAST32_MAX != __INT_LEAST32_MAX__ +#error "INT_LEAST32_MAX not usable in #if or wrong value" +#endif +#if UINT_LEAST32_MAX != __UINT_LEAST32_MAX__ +#error "UINT_LEAST32_MAX not usable in #if or wrong value" +#endif +#if INT_LEAST64_MIN != -__INT_LEAST64_MAX__-1 +#error "INT_LEAST64_MIN not usable in #if or wrong value" +#endif +#if INT_LEAST64_MAX != __INT_LEAST64_MAX__ +#error "INT_LEAST64_MAX not usable in #if or wrong value" +#endif +#if UINT_LEAST64_MAX != __UINT_LEAST64_MAX__ +#error "UINT_LEAST64_MAX not usable in #if or wrong value" +#endif + +#if INT_FAST8_MIN != -__INT_FAST8_MAX__-1 +#error "INT_FAST8_MIN not usable in #if or wrong value" +#endif +#if INT_FAST8_MAX != __INT_FAST8_MAX__ +#error "INT_FAST8_MAX not usable in #if or wrong value" +#endif +#if UINT_FAST8_MAX != __UINT_FAST8_MAX__ +#error "UINT_FAST8_MAX not usable in #if or wrong value" +#endif +#if INT_FAST16_MIN != -__INT_FAST16_MAX__-1 +#error "INT_FAST16_MIN not usable in #if or wrong value" +#endif +#if INT_FAST16_MAX != __INT_FAST16_MAX__ +#error "INT_FAST16_MAX not usable in #if or wrong value" +#endif +#if UINT_FAST16_MAX != __UINT_FAST16_MAX__ +#error "UINT_FAST16_MAX not usable in #if or wrong value" +#endif +#if INT_FAST32_MIN != -__INT_FAST32_MAX__-1 +#error "INT_FAST32_MIN not usable in #if or wrong value" +#endif +#if INT_FAST32_MAX != __INT_FAST32_MAX__ +#error "INT_FAST32_MAX not usable in #if or wrong value" +#endif +#if UINT_FAST32_MAX != __UINT_FAST32_MAX__ +#error "UINT_FAST32_MAX not usable in #if or wrong value" +#endif +#if INT_FAST64_MIN != -__INT_FAST64_MAX__-1 +#error "INT_FAST64_MIN not usable in #if or wrong value" +#endif +#if INT_FAST64_MAX != __INT_FAST64_MAX__ +#error "INT_FAST64_MAX not usable in #if or wrong value" +#endif +#if UINT_FAST64_MAX != __UINT_FAST64_MAX__ +#error "UINT_FAST64_MAX not usable in #if or wrong value" +#endif + +#if defined(INTPTR_MIN) && INTPTR_MIN != -__INTPTR_MAX__-1 +#error "INTPTR_MIN not usable in #if or wrong value" +#endif +#if defined(INTPTR_MAX) && INTPTR_MAX != __INTPTR_MAX__ +#error "INTPTR_MAX not usable in #if or wrong value" +#endif +#if defined(UINTPTR_MAX) && UINTPTR_MAX != __UINTPTR_MAX__ +#error "UINTPTR_MAX not usable in #if or wrong value" +#endif + +#if INTMAX_MIN != -__INTMAX_MAX__-1 +#error "INTMAX_MIN not usable in #if or wrong value" +#endif +#if INTMAX_MAX != __INTMAX_MAX__ +#error "INTMAX_MAX not usable in #if or wrong value" +#endif +#if UINTMAX_MAX != __UINTMAX_MAX__ +#error "UINTMAX_MAX not usable in #if or wrong value" +#endif + +#if PTRDIFF_MIN != -__PTRDIFF_MAX__-1 +#error "PTRDIFF_MIN not usable in #if or wrong value" +#endif +#if PTRDIFF_MAX != __PTRDIFF_MAX__ +#error "PTRDIFF_MAX not usable in #if or wrong value" +#endif + +#if SIG_ATOMIC_MIN != __SIG_ATOMIC_MIN__ +#error "SIG_ATOMIC_MIN not usable in #if or wrong value" +#endif +#if SIG_ATOMIC_MAX != __SIG_ATOMIC_MAX__ +#error "SIG_ATOMIC_MAX not usable in #if or wrong value" +#endif + +#if SIZE_MAX != __SIZE_MAX__ +#error "SIZE_MAX not usable in #if or wrong value" +#endif + +#if WCHAR_MIN != __WCHAR_MIN__ +#error "WCHAR_MIN not usable in #if or wrong value" +#endif +#if WCHAR_MAX != __WCHAR_MAX__ +#error "WCHAR_MAX not usable in #if or wrong value" +#endif + +#if WINT_MIN != __WINT_MIN__ +#error "WINT_MIN not usable in #if or wrong value" +#endif +#if WINT_MAX != __WINT_MAX__ +#error "WINT_MAX not usable in #if or wrong value" +#endif diff --git a/gcc/testsuite/gcc.dg/c99-stdint-8.c b/gcc/testsuite/gcc.dg/c99-stdint-8.c new file mode 100644 index 00000000000..c64b3feb4f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-8.c @@ -0,0 +1,9 @@ +/* Verify that the limits defined in are those GCC expects + internally to be defined and that they are usable in #if + conditions. Freestanding version. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -ffreestanding" } */ + +/* The test is that there are no diagnostics, so just include the + hosted version. */ +#include "c99-stdint-7.c" -- cgit v1.2.1