bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eric Blake
Subject: bug#17667: [PATCH] df: Initialize a variable to squash a compiler warning
Date: Mon, 02 Jun 2014 13:55:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]