Subject: bug#17667: [PATCH] df: Initialize a variable to squash a compiler warning

From: Eric Blake <[email-masked]>
Date: Mon, 02 Jun 2014 13:55:06 -0600

On 06/02/2014 01:22 PM, Pádraig Brady wrote:

>>          default:
>>            assert (!"bad field_type");
> 
> This is because assert() is not declared __noreturn__ on Solaris 10.

Huh? assert(nonzero) returns normally.  I thought __noreturn__ was
reserved for functions like exit() that really cannot return; assert(0)
does not return, but that does not mean it has the same semantics as
exit().  (Well, technically assert() is a macro, while the __noreturn__
semantics have to be attached to a function invoked by the macro - but
how do you portably determine which function is going to be invoked by
the macro?)

> That can be an important admonition for a compiler
> so I'm wondering should be detect this and provide a __noreturn__ wrapper.

In glibc, it is not assert() that is marked __noreturn__, but the
__assert_fail() internal function call that only gets triggered for
assert(0).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org