[PATCH B1/2] Redefine assert to use its expression
Roland McGrath
roland@hack.frob.com
Mon Mar 2 22:52:00 GMT 2015
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
More information about the Libc-alpha
mailing list