From d25724faa06d4681497286469367d82df728d2dc Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Thu, 16 Aug 2012 13:07:42 +0100 Subject: [PATCH] printf_testcases: validate assumptions test cases make (todo soon: add support for case of char being unsigned) --- platform/win32/internals/_PDCLIB_config.h | 8 ++++---- testing/_PDCLIB_test.h | 1 + testing/printf_testcases.h | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/win32/internals/_PDCLIB_config.h b/platform/win32/internals/_PDCLIB_config.h index c828c7a..27a87b9 100644 --- a/platform/win32/internals/_PDCLIB_config.h +++ b/platform/win32/internals/_PDCLIB_config.h @@ -274,10 +274,10 @@ struct _PDCLIB_imaxdiv_t #ifdef __GNUC__ typedef char * _PDCLIB_va_list; - #define _PDCLIB_va_arg( ap, type ) __builtin_va_arg( ap, type ) - #define _PDCLIB_va_copy( dest, src ) __builtin_va_copy( dest, src) - #define _PDCLIB_va_end( ap ) __builtin_va_end( ap ) - #define _PDCLIB_va_start( ap, parmN ) __builtin_va_start( ap, parmN ) + #define _PDCLIB_va_arg( ap, type ) (__builtin_va_arg( (ap), type )) + #define _PDCLIB_va_copy( dest, src ) (__builtin_va_copy( (dest), (src) )) + #define _PDCLIB_va_end( ap ) (__builtin_va_end( ap ) ) + #define _PDCLIB_va_start( ap, parmN ) (__builtin_va_start( (ap), (parmN) )) #else #error Compiler support please #endif diff --git a/testing/_PDCLIB_test.h b/testing/_PDCLIB_test.h index 1cb0222..e6d8c36 100644 --- a/testing/_PDCLIB_test.h +++ b/testing/_PDCLIB_test.h @@ -13,6 +13,7 @@ #include #include #include +#include /* Some strings used for and testing. */ static char const abcde[] = "abcde"; diff --git a/testing/printf_testcases.h b/testing/printf_testcases.h index e024784..1f5a714 100644 --- a/testing/printf_testcases.h +++ b/testing/printf_testcases.h @@ -1,5 +1,7 @@ { + assert(CHAR_MIN == -128); PRINTF_TEST( 4, "-128", "%hhd", CHAR_MIN ); + assert(CHAR_MAX == 127); PRINTF_TEST( 3, "127", "%hhd", CHAR_MAX ); PRINTF_TEST( 1, "0", "%hhd", 0 ); PRINTF_TEST( 6, "-32768", "%hd", SHRT_MIN ); -- 2.40.0