This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS.


On 07/09/15 20:53 +0100, Jonathan Wakely wrote:
On 07/09/15 21:04 +0200, Daniel Krügler wrote:
2015-09-07 20:27 GMT+02:00 Jonathan Wakely <jwakely@redhat.com>:
This patch adds the "debug mode lite" we've been talking about, by
changing __glibcxx_assert to be activated by _GLIBCXX_ASSERTIONS
instead of _GLIBCXX_DEBUG (and making the latter imply the former).

_GLIBCXX_ASSERTIONS is already used in Parallel Mode for enabling
optional assertions (although some of them are O(n) and so we might
want to change them to use another macro like _GLIBCXX_DEBUG or
_GLIBCXX_PARALLEL_ASSERTIONS instead).

With the change to define __glibcxx_assert() without Debug Mode we can
change most uses of _GLIBCXX_DEBUG_ASSERT to simply __glibcxx_assert,
so that the assertion is done when _GLIBCXX_ASSERTIONS is defined (not
only in Debug Mode).

I haven't added any new assertions yet, this just converts the
lightweight Debug Mode checks, but the next step will be to add
additional assertions to the (normal mode) containers. The google
branches contain several good examples of checks to add.

In the suggested doc changes:

+        When defined, <code>_GLIBCXX_ASSERTIONS</code> is defined
+        automatically, so all the assertions that enables are also enabled
+        in debug mode.

there seems to be a typo, presumably it should be

+        When defined, <code>_GLIBCXX_ASSERTIONS</code> is defined
+        automatically, so all the assertions that <ins>it</ins>
enables are also enabled
+        in debug mode.

instead?

It's correct as I wrote it, but your version is clearer so I'll change
it.

My original can be read as "so all the assertions that that enables"
where the first "that" can be removed without changing the meaning.
Stoopid English ;-)

I think this is even better:

 When defined, <code>_GLIBCXX_ASSERTIONS</code> is defined
 automatically, so all the assertions enabled by that macro are
 also enabled in debug mode.

Is that clear?


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