From 55a1ae4163ecc97601c8d3d216452b65eec405af Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 21 May 2024 13:45:02 +0200 Subject: tests: Avoid some compiler warnings. * tests/gpg/t-support.h (fail_with_syserr): New. (check_data): Use it to avoid compiler warnings. * tests/run-support.h (fail_with_syserr): New. -- I don't think that there is a way to tell gcc that gpgme_err_code_from_errno will never return 0. Thus we better use a different macro. --- tests/run-support.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/run-support.h') diff --git a/tests/run-support.h b/tests/run-support.h index d7b2987b..6471e2b9 100644 --- a/tests/run-support.h +++ b/tests/run-support.h @@ -48,6 +48,18 @@ while (0) +#define fail_with_syserr() \ + do \ + { \ + gpg_error_t _err = gpgme_err_code_from_errno (errno); \ + fprintf (stderr, PGM": file %s line %d: <%s> %s\n", \ + __FILE__, __LINE__, gpgme_strsource (_err), \ + gpgme_strerror (_err)); \ + exit (1); \ + } \ + while (0) + + static const char * nonnull (const char *s) { @@ -196,4 +208,3 @@ print_import_result (gpgme_import_result_t r) r->not_imported, r->skipped_v3_keys); } - -- cgit v1.2.3