Fix a unit test failure on ARM
While generating the check_expected() function calls, the mocker.py script does not consider functions that have arguments with non-integral types like typedefs of structures. Due to this, a function appendPQExpBufferVA() which has va_list argument, causes compilation error "aggregate value used where an integer was expected" in src/test/unit/mock/backend/libpq/pqexpbuffer_mock.c since the check_expected() is called for the va_list argument as well. This is because in the check_expected() definition, the arg is cast to an integral type such as long, which is illegal if the arg type is a structure. Now, this error shows up on ARM, but not on x86. The probable explanation is : va_list is defined as a typedef of __builtin_va_list, and __builtin_va_list is internally defined by gcc compiler, rather than a typedef statement in one of the gcc header files. So we cannot know what __builtin_va_list is defined as, but since it shows up only on ARM, it must be defined to some structure on ARM, and to some integral type such as int or long, on x86. Fix is to handle va_list as a special case and skip check_expected() call for variadic functions that use va_list rather than "..." notation. An ideal and bigger fix should have been to handle function arguments of structure types, but it's better to do that as a separate item, since it needs more thought, and a solution is not known as of now. Author: Amit Khandekar
Showing
想要评论请 注册 或 登录