[patch rfc] Gag gdb_assert related const condition warning

Andrew Cagney ac131313@redhat.com
Fri May 23 17:30:00 GMT 2003


Hello,

Given an ISO C compiler that doesn't provide __FUNCTION__ or equivalent 
(e.g., IRIX CC) gdb_assert would end up expanding into something like:

	!(expr) ? 0 :
		internal_error (__FILE__, __LINE__, "%s%sAssert %s",
			0 ? 0 : "", 0 ? ": ", "", #expr);

and the fact that the conditional expressions were both constant would 
irritate some compilers (issuing a warning, again IRIX ...).   The 
attached changes things so that the warning is no longer generated.

I'm motivated to do this because the IRIX compiler does issue other 
useful warnings but the above was swamping things :-/

Thoughts?

Baring objection, I'll commit in a few days.
Andrew
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20030523/b972b6fc/attachment.ksh>


More information about the Gdb-patches mailing list