This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: fix -Werror regressions with gcc 4.8 on x86_64
- From: Richard Henderson <rth at twiddle dot net>
- To: Roland McGrath <roland at hack dot frob dot com>, Alexandre Oliva <aoliva at redhat dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Tue, 06 Jan 2015 08:35:42 -0800
- Subject: Re: fix -Werror regressions with gcc 4.8 on x86_64
- Authentication-results: sourceware.org; auth=none
- References: <orr3vr3pa1 dot fsf at free dot home> <oregrq414g dot fsf at free dot home> <alpine dot DEB dot 2 dot 10 dot 1412231952260 dot 31777 at digraph dot polyomino dot org dot uk> <orwq5i2cae dot fsf at free dot home> <20150105233904 dot D664D2C3BCF at topped-with-meat dot com>
On 01/05/2015 03:39 PM, Roland McGrath wrote:
> I think what we want is to support building libc with NDEBUG but ensure
> that this doesn't break the test suite. One approach is some makefile
> machinations to ensure that -DNDEBUG gets removed from the options when
> compiling the test sources. But I think the better approach is to change
> all the test code using assert to use a different macro that exists just
> for test code, and never elides the checks.
>
For use within glibc itself, I think we should redefine assert with NDEBUG to
use __builtin_unreachable.
For the public header file, I guess we can't do that since we're not allowed to
have the side effects of the evaluation of the expression. But that's always
bad practice, and we shouldn't have any of that in glibc anyway.
I do wonder about the public header file using an expression like
__ASSERT_VOID_CAST (0 && (expr))
Side effects are not evaluated, but identifiers referenced in the expression
still get marked as "used", etc.
r~