mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-06 12:38:12 +02:00
test: move SPA_NORETURN attributes to header
Otherwise, when building with fortify-headers, I get an error because the compiler doesn't know pwtest_ptr_notnull will not return if the passed pointer is null, so it doesn't know the pointer subsequently passed to memmove via pw_array_remove will be non-null. In file included from ../spa/include/spa/utils/defs.h:11, from ../spa/include/spa/utils/string.h:15, from ../test/pwtest.h:15, from ../test/test-array.c:7: In function ‘memmove’, inlined from ‘array_test’ at ../test/test-array.c:66:2: /nix/store/9031y56lsf4mq177s68ql1axsf241r7j-fortify-headers-3.0.1/include/string.h:77:16: error: argument 1 is null but the corresponding size argument 3 value is [8, 18446744073709551615] [-Werror=nonnull] 77 | return __orig_memmove(__d, __s, __n); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /nix/store/9031y56lsf4mq177s68ql1axsf241r7j-fortify-headers-3.0.1/include/string.h:77:16: warning: ‘__orig_memmove’ reading 8 or more bytes from a region of size 0 [-Wstringop-overread] In function ‘array_test’: cc1: note: source object is likely at address zero In file included from /nix/store/9031y56lsf4mq177s68ql1axsf241r7j-fortify-headers-3.0.1/include/stdlib.h:33, from ../spa/include/spa/utils/string.h:11: /nix/store/9031y56lsf4mq177s68ql1axsf241r7j-fortify-headers-3.0.1/include/string.h:69:1: note: in a call to function ‘__orig_memmove’ declared with attribute ‘access (read_only, 2, 3)’ 69 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | ^~~~~~~~~~~
This commit is contained in:
parent
96ef2728b8
commit
49ce385c44
2 changed files with 7 additions and 7 deletions
|
|
@ -10,30 +10,37 @@
|
|||
/* This header should never be included on its own, it merely exists to make
|
||||
* the user-visible pwtest.h header more readable */
|
||||
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_condition(int exitstatus, const char *file, int line, const char *func,
|
||||
const char *condition, const char *message, ...);
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_comparison_int(const char *file, int line, const char *func,
|
||||
const char *operator, int a, int b,
|
||||
const char *astr, const char *bstr);
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_comparison_double(const char *file, int line, const char *func,
|
||||
const char *operator, double a, double b,
|
||||
const char *astr, const char *bstr);
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_comparison_ptr(const char *file, int line, const char *func,
|
||||
const char *comparison);
|
||||
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_comparison_str(const char *file, int line, const char *func,
|
||||
const char *comparison, const char *a, const char *b);
|
||||
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_comparison_bool(const char *file, int line, const char *func,
|
||||
const char *operator, bool a, bool b,
|
||||
const char *astr, const char *bstr);
|
||||
|
||||
SPA_NORETURN
|
||||
void
|
||||
_pwtest_fail_errno(const char *file, int line, const char *func,
|
||||
int expected, int err_no);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,6 @@ static void pwtest_backtrace(pid_t p)
|
|||
}
|
||||
|
||||
SPA_PRINTF_FUNC(6, 7)
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_condition(int exitstatus,
|
||||
const char *file, int line, const char *func,
|
||||
const char *condition, const char *message, ...)
|
||||
|
|
@ -259,7 +258,6 @@ void _pwtest_fail_condition(int exitstatus,
|
|||
exit(exitstatus);
|
||||
}
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_comparison_bool(const char *file, int line, const char *func,
|
||||
const char *operator, bool a, bool b,
|
||||
const char *astr, const char *bstr)
|
||||
|
|
@ -271,7 +269,6 @@ void _pwtest_fail_comparison_bool(const char *file, int line, const char *func,
|
|||
exit(PWTEST_FAIL);
|
||||
}
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_errno(const char *file, int line, const char *func,
|
||||
int expected, int err_no)
|
||||
{
|
||||
|
|
@ -283,7 +280,6 @@ void _pwtest_fail_errno(const char *file, int line, const char *func,
|
|||
}
|
||||
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_comparison_int(const char *file, int line, const char *func,
|
||||
const char *operator, int a, int b,
|
||||
const char *astr, const char *bstr)
|
||||
|
|
@ -295,7 +291,6 @@ void _pwtest_fail_comparison_int(const char *file, int line, const char *func,
|
|||
exit(PWTEST_FAIL);
|
||||
}
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_comparison_double(const char *file, int line, const char *func,
|
||||
const char *operator, double a, double b,
|
||||
const char *astr, const char *bstr)
|
||||
|
|
@ -307,7 +302,6 @@ void _pwtest_fail_comparison_double(const char *file, int line, const char *func
|
|||
exit(PWTEST_FAIL);
|
||||
}
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_comparison_ptr(const char *file, int line, const char *func,
|
||||
const char *comparison)
|
||||
{
|
||||
|
|
@ -317,7 +311,6 @@ void _pwtest_fail_comparison_ptr(const char *file, int line, const char *func,
|
|||
exit(PWTEST_FAIL);
|
||||
}
|
||||
|
||||
SPA_NORETURN
|
||||
void _pwtest_fail_comparison_str(const char *file, int line, const char *func,
|
||||
const char *comparison, const char *a, const char *b)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue