diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-09-09 14:12:30 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-09-09 14:12:30 +0300 |
commit | f2d084fe3f0d6d71488bfc6987f26542f67bfd99 (patch) | |
tree | 07a11b27d1bec5a8e1f22499f887eb7b26f04d58 /tests/tuktest.h | |
parent | liblzma: lzma_filters_copy: Keep dest[] unmodified if an error occurs. (diff) | |
download | xz-f2d084fe3f0d6d71488bfc6987f26542f67bfd99.tar.xz |
Tests: Silence warnings about unused functions from tuktest.h.
Warnings about unused tuktest_run_test conveniently tell which
test programs haven't been converted to tuktest.h yet but I
silenced that warning too for now anyway.
It is fine to use __attribute__((__unused__)) even when the
function is actually used because the attribute only means
that the function might be unused.
Diffstat (limited to 'tests/tuktest.h')
-rw-r--r-- | tests/tuktest.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/tuktest.h b/tests/tuktest.h index 2a466220..18918188 100644 --- a/tests/tuktest.h +++ b/tests/tuktest.h @@ -153,6 +153,14 @@ #endif +// This is silencing warnings about unused functions. Not all test programs +// need all functions from this header. +#if TUKTEST_GNUC_REQ(3, 0) +# define tuktest_maybe_unused __attribute__((__unused__)) +#else +# define tuktest_maybe_unused +#endif + // We need printf("") so silence the warning about empty format string. #if TUKTEST_GNUC_REQ(4, 2) # pragma GCC diagnostic ignored "-Wformat-zero-length" @@ -561,6 +569,7 @@ tuktest_end(void) #define tuktest_run(testfunc) \ tuktest_run_test(&(testfunc), #testfunc) +tuktest_maybe_unused static void tuktest_run_test(void (*testfunc)(void), const char *testfunc_str) { @@ -639,6 +648,7 @@ tuktest_run_test(void (*testfunc)(void), const char *testfunc_str) tuktest_file_from_x(NULL, filename, sizeptr, __FILE__, __LINE__) // Internal helper for the macros above. +tuktest_maybe_unused static void * tuktest_file_from_x(const char *prefix, const char *filename, size_t *size, const char *prog_filename, unsigned prog_line) |