* [committed][gdb/testsuite] Fix Wunused-result warning in until-reverse.c
@ 2020-05-01 9:04 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-05-01 9:04 UTC (permalink / raw)
To: gdb-patches
Hi,
When running test-case gdb.reverse/until-reverse.exp or
gdb.reverse/until-precsave.exp with gcc-10, we run into a Wunused-result
warning:
...
gdb compile failed, gdb.reverse/until-reverse.c: In function 'main':
gdb.reverse/until-reverse.c:40:14: warning: ignoring return value of \
'malloc' declared with attribute 'warn_unused_result' [-Wunused-result]
40 | (void) malloc (1);
| ^~~~~~~~~~
...
Fix this by using the result of malloc as argument to a free call.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Fix Wunused-result warning in until-reverse.c
gdb/testsuite/ChangeLog:
2020-05-01 Tom de Vries <tdevries@suse.de>
* gdb.reverse/until-reverse.c (main): Fix Wunused-result warning.
---
gdb/testsuite/gdb.reverse/until-reverse.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.c b/gdb/testsuite/gdb.reverse/until-reverse.c
index e523235f34c..a8d8aed9aac 100644
--- a/gdb/testsuite/gdb.reverse/until-reverse.c
+++ b/gdb/testsuite/gdb.reverse/until-reverse.c
@@ -37,7 +37,8 @@ main (int argc, char **argv, char **envp)
{
/* We're used by a test that requires malloc, so make sure it is
in the executable. */
- (void) malloc (1);
+ void *p = malloc (1);
+ free (p);
return 1;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-01 9:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 9:04 [committed][gdb/testsuite] Fix Wunused-result warning in until-reverse.c Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox