* [Qemu-devel] [PATCH] target-ppc: Fix compiler warning
@ 2014-06-17 17:18 Stefan Weil
2014-06-17 19:40 ` Alexander Graf
2014-06-21 12:39 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2014-06-17 17:18 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Stefan Weil, qemu-ppc, Alexander Graf
gcc reports a warning which is usually wrong:
target-ppc/dfp_helper.c: In function ‘dfp_get_digit’:
target-ppc/dfp_helper.c:417:1: warning:
control reaches end of non-void function [-Wreturn-type]
The compiler shows the warning if assert is not marked with the noreturn
attribute or if the code is compiled with -DNDEBUG.
Using g_assert_not_reached better documents the intention and does not
have these problems.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
target-ppc/dfp_helper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/target-ppc/dfp_helper.c b/target-ppc/dfp_helper.c
index 773803a..49820bf 100644
--- a/target-ppc/dfp_helper.c
+++ b/target-ppc/dfp_helper.c
@@ -411,9 +411,8 @@ static inline int dfp_get_digit(decNumber *dn, int n)
return (dn->lsu[unit] / 10) % 10;
case 2:
return dn->lsu[unit] / 100;
- default:
- assert(0);
}
+ g_assert_not_reached();
}
#define DFP_HELPER_TAB(op, dnop, postprocs, size) \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: Fix compiler warning
2014-06-17 17:18 [Qemu-devel] [PATCH] target-ppc: Fix compiler warning Stefan Weil
@ 2014-06-17 19:40 ` Alexander Graf
2014-06-21 12:39 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2014-06-17 19:40 UTC (permalink / raw)
To: Stefan Weil, qemu-devel; +Cc: qemu-trivial, qemu-ppc
On 17.06.14 19:18, Stefan Weil wrote:
> gcc reports a warning which is usually wrong:
>
> target-ppc/dfp_helper.c: In function ‘dfp_get_digit’:
> target-ppc/dfp_helper.c:417:1: warning:
> control reaches end of non-void function [-Wreturn-type]
>
> The compiler shows the warning if assert is not marked with the noreturn
> attribute or if the code is compiled with -DNDEBUG.
>
> Using g_assert_not_reached better documents the intention and does not
> have these problems.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Please take it via -trivial.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] target-ppc: Fix compiler warning
2014-06-17 17:18 [Qemu-devel] [PATCH] target-ppc: Fix compiler warning Stefan Weil
2014-06-17 19:40 ` Alexander Graf
@ 2014-06-21 12:39 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2014-06-21 12:39 UTC (permalink / raw)
To: Stefan Weil, qemu-devel; +Cc: qemu-trivial, qemu-ppc, Alexander Graf
17.06.2014 21:18, Stefan Weil wrote:
> gcc reports a warning which is usually wrong:
[]
> Using g_assert_not_reached better documents the intention and does not
> have these problems.
Applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-21 12:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 17:18 [Qemu-devel] [PATCH] target-ppc: Fix compiler warning Stefan Weil
2014-06-17 19:40 ` Alexander Graf
2014-06-21 12:39 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.