On 25/05/15 15:31 +0200, François Dumont wrote:
Hi
This is a patch to clean the debug mode code.
I have introduced a new debug header, assertions.h, so that
headers that only need _GLIBCXX_DEBUG_ASSERT do not have to include
the big debug.h. I also introduce functions.tcc to isolate
implementation of __foreign_iterator which require a number of other
headers.
All other uses of .tcc extensions are headers included automatically
at the bottom of the corresponding .h header, so other headers never
need to do #include <foo.tcc> because that appears at the end of
<foo.h> (or <foo> for standard headers).
Also, .tcc is meant to be for definitions of non-inline templates that
are declared (but not defined) in the header that includes the .tcc
file, but all the functions you're moving to <debug/functions.tcc> are
still small and inline.
If the point is just to move some functions to a different header
because not all consumers of functions.h need those functions then I
think it should have a different name, not pretend to be related to
functions.h
I'm not convinced moving them to a separate header is even a good
idea. Surely most headers that include <debug/functions.h> already end
up including <bits/move.h> and <type_traits> anyway?
* include/debug/debug.h ([_GLIBCXX_DEBUG_ASSERT,
_GLIBCXX_DEBUG_PEDASSERT, _GLIBCXX_DEBUG_ONLY]): Move definition...
These names should not be in square brackets (square brackets are used
to indicate conditional changes, see
http://www.gnu.org/prep/standards/html_node/Conditional-Changes.html)
(__check_dereferenceable, __valid_range): Move here overload for
_Safe_iterator.
(struct __is_safe_random_iterator): Move here partial specialization
for _Safe_iterator.
These should say "Move X here" not "Move here X".
Index: include/debug/functions.tcc
===================================================================
--- include/debug/functions.tcc (revision 0)
+++ include/debug/functions.tcc (working copy)
@@ -0,0 +1,159 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
It worries me when we move existing code to new headers and only give
it the current year as the copyright date. The copyright applies to
the code, which is older than 2015, not to the file itself.
I think I've asked about this before and been told that only adding
the current year is correct, but that seems wrong to me. I'll try to
confirm that.