This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fix -Werror regressions with gcc 4.8 on x86_64


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]