subsystems: Rename reserved function names

Rename reserved function names in the subsys/ subdirectory except
for static _mod_pub_set and _mod_unbind functions in bluetooth mesh
cfg_srv.c which clash with the similarly named global functions.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2019-03-14 19:42:51 -06:00 committed by Anas Nashif
commit 4aa48833d8
30 changed files with 207 additions and 208 deletions

View file

@ -77,13 +77,13 @@ static __unused const char *TC_RESULT_STR[] = {
#define TC_END(result, fmt, ...) PRINT_DATA(fmt, ##__VA_ARGS__)
/* prints result and the function name */
#define _TC_END_RESULT(result, func) \
#define Z_TC_END_RESULT(result, func) \
do { \
TC_END(result, "%s - %s\n", TC_RESULT_TO_STR(result), func); \
PRINT_LINE; \
} while (0)
#define TC_END_RESULT(result) \
_TC_END_RESULT((result), __func__)
Z_TC_END_RESULT((result), __func__)
#if defined(CONFIG_ARCH_POSIX)
#define TC_END_POST(result) posix_exit(result)

View file

@ -22,7 +22,7 @@
void ztest_test_fail(void);
#if CONFIG_ZTEST_ASSERT_VERBOSE == 0
static inline void _zassert_(int cond, const char *file, int line)
static inline void z_zassert_(int cond, const char *file, int line)
{
if (!(cond)) {
PRINT("\n Assertion failed at %s:%d\n",
@ -31,12 +31,12 @@ static inline void _zassert_(int cond, const char *file, int line)
}
}
#define _zassert(cond, default_msg, file, line, func, msg, ...) \
_zassert_(cond, file, line)
#define z_zassert(cond, default_msg, file, line, func, msg, ...) \
z_zassert_(cond, file, line)
#else /* CONFIG_ZTEST_ASSERT_VERBOSE != 0 */
static inline void _zassert(int cond,
static inline void z_zassert(int cond,
const char *default_msg,
const char *file,
int line, const char *func,
@ -85,7 +85,7 @@ static inline void _zassert(int cond,
*/
#define zassert(cond, default_msg, msg, ...) \
_zassert(cond, msg ? ("(" default_msg ")") : (default_msg), \
z_zassert(cond, msg ? ("(" default_msg ")") : (default_msg), \
__FILE__, __LINE__, __func__, msg ? msg : "", ##__VA_ARGS__)
/**

View file

@ -34,7 +34,7 @@
* @param value Value for @a param
*/
#define ztest_expect_value(func, param, value) \
_ztest_expect_value(STRINGIFY(func), STRINGIFY(param), \
z_ztest_expect_value(STRINGIFY(func), STRINGIFY(param), \
(uintptr_t)(value))
/**
@ -49,7 +49,7 @@
* @param param Parameter to check
*/
#define ztest_check_expected_value(param) \
_ztest_check_expected_value(__func__, STRINGIFY(param), \
z_ztest_check_expected_value(__func__, STRINGIFY(param), \
(uintptr_t)(param))
/**
@ -59,7 +59,7 @@
* @param value Value to return from @a func
*/
#define ztest_returns_value(func, value) \
_ztest_returns_value(STRINGIFY(func), (uintptr_t)(value))
z_ztest_returns_value(STRINGIFY(func), (uintptr_t)(value))
/**
* @brief Get the return value for current function
@ -70,7 +70,7 @@
* @returns The value the current function should return
*/
#define ztest_get_return_value() \
_ztest_get_return_value(__func__)
z_ztest_get_return_value(__func__)
/**
* @brief Get the return value as a pointer for current function
@ -81,7 +81,7 @@
* @returns The value the current function should return as a `void *`
*/
#define ztest_get_return_value_ptr() \
((void *)_ztest_get_return_value(__func__))
((void *)z_ztest_get_return_value(__func__))
/**
* @}
@ -91,20 +91,20 @@
#include <zephyr/types.h>
void _init_mock(void);
int _cleanup_mock(void);
void z_init_mock(void);
int z_cleanup_mock(void);
void _ztest_expect_value(const char *fn, const char *name, uintptr_t value);
void _ztest_check_expected_value(const char *fn, const char *param,
void z_ztest_expect_value(const char *fn, const char *name, uintptr_t value);
void z_ztest_check_expected_value(const char *fn, const char *param,
uintptr_t value);
void _ztest_returns_value(const char *fn, uintptr_t value);
uintptr_t _ztest_get_return_value(const char *fn);
void z_ztest_returns_value(const char *fn, uintptr_t value);
uintptr_t z_ztest_get_return_value(const char *fn);
#else /* !CONFIG_ZTEST_MOCKING */
#define _init_mock()
#define _cleanup_mock() 0
#define z_init_mock()
#define z_cleanup_mock() 0
#endif /* CONFIG_ZTEST_MOCKING */

View file

@ -23,7 +23,7 @@ struct unit_test {
u32_t thread_options;
};
void _ztest_run_test_suite(const char *name, struct unit_test *suite);
void z_ztest_run_test_suite(const char *name, struct unit_test *suite);
/**
* @defgroup ztest_test Ztest testing macros
@ -164,7 +164,7 @@ extern struct k_mem_domain ztest_mem_domain;
* @param suite Test suite to run.
*/
#define ztest_run_test_suite(suite) \
_ztest_run_test_suite(#suite, _##suite)
z_ztest_run_test_suite(#suite, _##suite)
/**
* @}

View file

@ -31,7 +31,7 @@ static int cleanup_test(struct unit_test *test)
int ret = TC_PASS;
int mock_status;
mock_status = _cleanup_mock();
mock_status = z_cleanup_mock();
#ifdef KERNEL
/* we need to remove the ztest_thread information from the timeout_q.
@ -138,7 +138,7 @@ static int run_test(struct unit_test *test)
run_test_functions(test);
out:
ret |= cleanup_test(test);
_TC_END_RESULT(ret, test->name);
Z_TC_END_RESULT(ret, test->name);
return ret;
}
@ -234,9 +234,9 @@ static int run_test(struct unit_test *test)
}
if (test_result == -2) {
_TC_END_RESULT(TC_SKIP, test->name);
Z_TC_END_RESULT(TC_SKIP, test->name);
} else {
_TC_END_RESULT(ret, test->name);
Z_TC_END_RESULT(ret, test->name);
}
return ret;
@ -244,7 +244,7 @@ static int run_test(struct unit_test *test)
#endif /* !KERNEL */
void _ztest_run_test_suite(const char *name, struct unit_test *suite)
void z_ztest_run_test_suite(const char *name, struct unit_test *suite)
{
int fail = 0;
@ -290,7 +290,7 @@ K_APPMEM_PARTITION_DEFINE(ztest_mem_partition);
#ifndef KERNEL
int main(void)
{
_init_mock();
z_init_mock();
test_main();
end_report();
@ -320,7 +320,7 @@ void main(void)
k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
#endif /* CONFIG_USERSPACE */
_init_mock();
z_init_mock();
test_main();
end_report();
}

View file

@ -39,7 +39,7 @@ static struct parameter *alloc_parameter(void)
return param;
}
void _init_mock(void)
void z_init_mock(void)
{
}
@ -126,7 +126,7 @@ struct parameter *alloc_parameter(void)
return param;
}
void _init_mock(void)
void z_init_mock(void)
{
}
@ -176,12 +176,12 @@ static void insert_value(struct parameter *param, const char *fn,
static struct parameter parameter_list = { NULL, "", "", 0 };
static struct parameter return_value_list = { NULL, "", "", 0 };
void _ztest_expect_value(const char *fn, const char *name, uintptr_t val)
void z_ztest_expect_value(const char *fn, const char *name, uintptr_t val)
{
insert_value(&parameter_list, fn, name, val);
}
void _ztest_check_expected_value(const char *fn, const char *name,
void z_ztest_check_expected_value(const char *fn, const char *name,
uintptr_t val)
{
struct parameter *param;
@ -206,13 +206,13 @@ void _ztest_check_expected_value(const char *fn, const char *name,
}
}
void _ztest_returns_value(const char *fn, uintptr_t value)
void z_ztest_returns_value(const char *fn, uintptr_t value)
{
insert_value(&return_value_list, fn, "", value);
}
uintptr_t _ztest_get_return_value(const char *fn)
uintptr_t z_ztest_get_return_value(const char *fn)
{
uintptr_t value;
struct parameter *param = find_and_delete_value(&return_value_list,
@ -240,7 +240,7 @@ static void free_param_list(struct parameter *param)
}
}
int _cleanup_mock(void)
int z_cleanup_mock(void)
{
int fail = 0;