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.
This commit is contained in:
parent
c933269d3a
commit
55a1ae4163
@ -53,6 +53,17 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
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)
|
||||||
|
|
||||||
|
|
||||||
#ifdef GPGRT_HAVE_MACRO_FUNCTION
|
#ifdef GPGRT_HAVE_MACRO_FUNCTION
|
||||||
void GPGRT_ATTR_NORETURN
|
void GPGRT_ATTR_NORETURN
|
||||||
@ -131,9 +142,9 @@ check_data (gpgme_data_t dh, const char *expected)
|
|||||||
|
|
||||||
ret = gpgme_data_seek (dh, 0, SEEK_SET);
|
ret = gpgme_data_seek (dh, 0, SEEK_SET);
|
||||||
if (ret)
|
if (ret)
|
||||||
fail_if_err (gpgme_err_code_from_errno (errno));
|
fail_with_syserr ();
|
||||||
if ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) < 0)
|
if ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) < 0)
|
||||||
fail_if_err (gpgme_err_code_from_errno (errno));
|
fail_with_syserr ();
|
||||||
buf[ret] = 0;
|
buf[ret] = 0;
|
||||||
if (ret != expectedlen || strncmp (buf, expected, expectedlen))
|
if (ret != expectedlen || strncmp (buf, expected, expectedlen))
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,18 @@
|
|||||||
while (0)
|
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 *
|
static const char *
|
||||||
nonnull (const char *s)
|
nonnull (const char *s)
|
||||||
{
|
{
|
||||||
@ -196,4 +208,3 @@ print_import_result (gpgme_import_result_t r)
|
|||||||
r->not_imported,
|
r->not_imported,
|
||||||
r->skipped_v3_keys);
|
r->skipped_v3_keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user