This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, François Dumont <frs dot dumont at gmail dot com>
- Date: Tue, 8 Sep 2015 15:34:02 +0100
- Subject: Re: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS.
- Authentication-results: sourceware.org; auth=none
- References: <20150907182755 dot GP2631 at redhat dot com> <87r3mauiud dot fsf at mid dot deneb dot enyo dot de> <20150907195939 dot GT2631 at redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1509081511360 dot 30229 at wotan dot suse dot de>
On 08/09/15 15:14 +0200, Michael Matz wrote:
On Mon, 7 Sep 2015, Jonathan Wakely wrote:
> Interesting. Is this mode ABI-compatible with the default mode?
Yes, that's the main reason I want to make this change.
> Should _FORTIFY_SOURCE imply _GLIBCXX_ASSERTIONS?
Yes, I think it should.
Then at least those assertions that lie in a different big-O complexity
class have to be moved away from _GLIBCXX_ASSERTIONS (as hinted in your
initial mail). Some distros build packages with _FORTIFY_SOURCE, and
while additional asserts seem acceptable, going from constant to linear
(or the like) seems not.
AFAIK no distros have anything that depends on the libstdc++ Parallel
Mode (which enables O(n) checks under _GLIBCXX_ASSERTIONS), but as I
suggested I think those should be moved to another macro anyway.
Anything currently enabled by _GLIBCXX_DEBUG that changes the big-O
complexity is not touched by my patch, so wouldn't be enabled by
_GLIBCXX_ASSERTIONS. That's by design.
The existing _GLIBCXX_DEBUG Debug Mode is very important, and far more
powerful than the checks enabled by _GLIBCXX_ASSERTIONS will ever be,
but the ABI impact and the violations of the standard's complexity
guarantees mean that there are places it can't be used. For
_GLIBCXX_ASSERTIONS to be worthwhile it has to be usable in almost any
situations. In particular it should be reasonable to build entire
distros with those checks enabled.