aboutsummaryrefslogtreecommitdiff
path: root/libctf/testsuite/libctf-regression
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-06-19 14:06:26 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-06-19 15:51:24 +0100
commitb84ffc176d3ab90a5dd42e406f84b2207f2782ca (patch)
tree7fb14515c901b47af902f63096bd9d75fced6343 /libctf/testsuite/libctf-regression
parentea4e03c0a9f5ed8574dcaa434cd979a6f92f5c1f (diff)
downloadbinutils-b84ffc176d3ab90a5dd42e406f84b2207f2782ca.zip
binutils-b84ffc176d3ab90a5dd42e406f84b2207f2782ca.tar.gz
binutils-b84ffc176d3ab90a5dd42e406f84b2207f2782ca.tar.bz2
libctf: fix testsuite bugs revealed by -Wall
Most of these are harmless, but some of the type confusions and especially a missing ctf_strerror() on an error path were actual bugs that could have resulted in test failures crashing rather than printing an error message. libctf/ * testsuite/libctf-lookup/enumerator-iteration.c: Fix type confusion, signedness confusion and a missing ctf_errmsg(). * testsuite/libctf-regression/libctf-repeat-cu-main.c: Return 0 from the test function. * testsuite/libctf-regression/open-error-free.c: Fix signedness confusion. * testsuite/libctf-regression/zrewrite.c: Remove unused label.
Diffstat (limited to 'libctf/testsuite/libctf-regression')
-rw-r--r--libctf/testsuite/libctf-regression/libctf-repeat-cu-main.c2
-rw-r--r--libctf/testsuite/libctf-regression/open-error-free.c2
-rw-r--r--libctf/testsuite/libctf-regression/zrewrite.c3
3 files changed, 2 insertions, 5 deletions
diff --git a/libctf/testsuite/libctf-regression/libctf-repeat-cu-main.c b/libctf/testsuite/libctf-regression/libctf-repeat-cu-main.c
index bfbaf0c..c1f2f63 100644
--- a/libctf/testsuite/libctf-regression/libctf-repeat-cu-main.c
+++ b/libctf/testsuite/libctf-regression/libctf-repeat-cu-main.c
@@ -2,4 +2,4 @@ typedef short ret_t;
int a (void);
int b (void);
int c (void);
-int blah (void) { a(); b(); c(); }
+int blah (void) { a(); b(); c(); return 0; }
diff --git a/libctf/testsuite/libctf-regression/open-error-free.c b/libctf/testsuite/libctf-regression/open-error-free.c
index edc5f34..7405cdb 100644
--- a/libctf/testsuite/libctf-regression/open-error-free.c
+++ b/libctf/testsuite/libctf-regression/open-error-free.c
@@ -143,7 +143,7 @@ int main (void)
failure after we corrupt it: the leak is only observable if the dict gets
malloced, which only happens after that point.) */
- if ((written = ctf_write_mem (fp, &written_size, (size_t) -1)) == NULL)
+ if ((written = (char *) ctf_write_mem (fp, &written_size, (size_t) -1)) == NULL)
goto write_err;
ctf_dict_close (fp);
diff --git a/libctf/testsuite/libctf-regression/zrewrite.c b/libctf/testsuite/libctf-regression/zrewrite.c
index 5e061f1..3ddc354 100644
--- a/libctf/testsuite/libctf-regression/zrewrite.c
+++ b/libctf/testsuite/libctf-regression/zrewrite.c
@@ -150,7 +150,4 @@ main (int argc, char *argv[])
write_stderr:
fprintf (stderr, "%s: cannot open for writing: %s\n", argv[0], strerror (errno));
return 1;
- read_err:
- fprintf (stderr, "%s: cannot read\n", argv[0]);
- return 1;
}