From 9c8421dafe6346793f84e44d6169a52c07f36544 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 19 Sep 2012 20:36:05 +0000 Subject: [PATCH] [PSDK] - Add _Check_return_opt and _Check_return_wat_ annotations [WINE] - Add ok_size_t(), ok_char() and ok_wstr() to test.h svn path=/trunk/; revision=57341 --- reactos/include/psdk/specstrings.h | 12 ++++++++++++ reactos/include/reactos/wine/test.h | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/reactos/include/psdk/specstrings.h b/reactos/include/psdk/specstrings.h index afeb7930dfa..7d08f26522c 100644 --- a/reactos/include/psdk/specstrings.h +++ b/reactos/include/psdk/specstrings.h @@ -60,3 +60,15 @@ #define __analysis_noreturn #endif + +#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN) +#define _Check_return_opt_ _Check_return_ +#else +#define _Check_return_opt_ +#endif + +#if defined(_PREFAST_) && defined(_PFT_SHOULD_CHECK_RETURN_WAT) +#define _Check_return_wat_ _Check_return_ +#else +#define _Check_return_wat_ +#endif diff --git a/reactos/include/reactos/wine/test.h b/reactos/include/reactos/wine/test.h index 44b7b506d6f..df4b3258a57 100644 --- a/reactos/include/reactos/wine/test.h +++ b/reactos/include/reactos/wine/test.h @@ -646,12 +646,24 @@ int main( int argc, char **argv ) #expression, (void*)(result), _value); \ } while (0) +#define ok_size_t(expression, result) \ + do { \ + size_t _value = (expression); \ + ok(_value == (result), "Wrong value for '%s', expected: " #result " (%p), got: %p\n", \ + #expression, (size_t)(result), _value); \ + } while (0) + +#define ok_char(expression, result) ok_hex(expression, result) + #define ok_err(error) \ ok(GetLastError() == (error), "Wrong last error. Expected " #error ", got %d\n", (int)GetLastError()) #define ok_str(x, y) \ ok(strcmp(x, y) == 0, "Wrong string. Expected '%s', got '%s'\n", y, x) +#define ok_wstr(x, y) \ + ok(wcscmp(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x) + #define ok_long(expression, result) ok_hex(expression, result) #define ok_int(expression, result) ok_dec(expression, result) #define ok_ntstatus(status, expected) ok_hex(status, expected)