From 8c834861b9547e4b3b44471cfc3257fa5d1493bf Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Tue, 9 Feb 2021 12:44:09 -0500 Subject: [PATCH] Fix #781, Terminate UT macro variadic lists --- ut_assert/inc/utstubs.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index 7c532ec6f..75fd021f5 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -463,8 +463,15 @@ int32 UT_DefaultStubImpl(const char *FunctionName, UT_EntryKey_t FuncKey, int32 * * This version should be used on stubs that take no arguments * and are expected to return 0 in the nominal case + * + * NOTE - Adding a NULL to the va list is only done for the + * two macros that do not have a va list passed in by the + * caller and is NOT a general pattern. Hooks that handle + * va lists should utilize the UT_KEY to process + * va lists correctly based on the implementation (no + * general pattern should be assumed). */ -#define UT_DEFAULT_IMPL(FuncName) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), 0) +#define UT_DEFAULT_IMPL(FuncName) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), 0, NULL) /** * Macro to simplify usage of the UT_DefaultStubImpl() function @@ -475,8 +482,15 @@ int32 UT_DefaultStubImpl(const char *FunctionName, UT_EntryKey_t FuncKey, int32 * * This version should be used on stubs that take no arguments * and are expected to return nonzero in the nominal case + * + * NOTE - Adding a NULL to the va list is only done for the + * two macros that do not have a va list passed in by the + * caller and is NOT a general pattern. Hooks that handle + * va lists should utilize the UT_KEY to process + * va lists correctly based on the implementation (no + * general pattern should be assumed). */ -#define UT_DEFAULT_IMPL_RC(FuncName, Rc) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), Rc) +#define UT_DEFAULT_IMPL_RC(FuncName, Rc) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), Rc, NULL) /** * Macro to simplify usage of the UT_DefaultStubImpl() function