This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH B1/2] Redefine assert to use its expression
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 2 Mar 2015 14:52:55 -0800 (PST)
- Subject: Re: [PATCH B1/2] Redefine assert to use its expression
- Authentication-results: sourceware.org; auth=none
- References: <1420827419-18655-1-git-send-email-rth at twiddle dot net> <1420827419-18655-2-git-send-email-rth at twiddle dot net>
I thought I argued before for using a new internal macro instead of
overloading assert with different semantics. That's more immediate
make-work of replacing existing assert uses, but IMHO more maintainable in
the long run. But I don't recall any more exactly how the previous
discussion went.
> This also fixes the -Werrors from -DNDEBUG on x86_64, but in
> the opposite direction. We make assert always use its expression.
> This requires removing some existing ifndefs that were working
> around this same problem of unused variables.
This is the approach I like, certainly, regardless of whether we decide to
change assert itself or use a new macro name.
> There is exactly one compilation difference from patch A1, in
> fork.os, where the THREAD_GETMEM read cannot be optimized away,
> because the asm is marked volatile. (Yet another reason to finish
> code in gcc to expose segments as address spaces, so that this can
> be written in C.)
Not to discourage you from implementing something in GCC, but why do those
asm's use volatile? I don't see a reason they should. Obviously the
storing ones need to, but the fetching ones shouldn't.
Thanks,
Roland