re PR libstdc++/31518 (_GLIBCXX_DEBUG error message formatter line width not configurable)

2007-07-03  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/31518
	* include/debug/formatter.h (_Error_formatter::_M_get_max_length): New.
	(_Error_formatter::_Error_formatter): Use it.
	* src/debug.cc: Define.
	(_Error_formatter::_M_error): Tweak.
	* configure.ac: Adjust version to 6:10:0.
	* config/abi/pre/gnu.ver: Export _Error_formatter::_M_get_max_length
	at GLIBCXX_3.4.10.
	* testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.10.
	* docs/html/debug.html: Document.
	* configure: Regenerate.

From-SVN: r126287
This commit is contained in:
Paolo Carlini 2007-07-04 00:09:22 +00:00 committed by Paolo Carlini
parent e3ceb300c5
commit 5dddb7e5eb
8 changed files with 58 additions and 7 deletions

View File

@ -1,3 +1,17 @@
2007-07-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31518
* include/debug/formatter.h (_Error_formatter::_M_get_max_length): New.
(_Error_formatter::_Error_formatter): Use it.
* src/debug.cc: Define.
(_Error_formatter::_M_error): Tweak.
* configure.ac: Adjust version to 6:10:0.
* config/abi/pre/gnu.ver: Export _Error_formatter::_M_get_max_length
at GLIBCXX_3.4.10.
* testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.10.
* docs/html/debug.html: Document.
* configure: Regenerate.
2007-07-02 Douglas Gregor <doug.gregor@gmail.com>
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:

View File

@ -122,8 +122,8 @@ GLIBCXX_3.4 {
std::__num_base::_S_atoms_out;
std::__moneypunct_cache*;
std::__numpunct_cache*;
std::__timepunct_cache*;
__gnu_debug::_Error_formatter*
std::__timepunct_cache*
# __gnu_debug::_Error_formatter*
};
# Names not in an 'extern' block are mangled names.
@ -138,6 +138,13 @@ GLIBCXX_3.4 {
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
# __gnu_debug::_Error_formatter
_ZNK11__gnu_debug16_Error_formatter10_M_message*;
_ZNK11__gnu_debug16_Error_formatter10_Parameter*;
_ZNK11__gnu_debug16_Error_formatter13_M_print_word*;
_ZNK11__gnu_debug16_Error_formatter15_M_print_string*;
_ZNK11__gnu_debug16_Error_formatter8_M_error*;
# std::string
_ZNSsC*;
_ZNSsD*;
@ -708,6 +715,12 @@ GLIBCXX_3.4.9 {
} GLIBCXX_3.4.8;
GLIBCXX_3.4.10 {
_ZNK11__gnu_debug16_Error_formatter17_M_get_max_lengthEv;
} GLIBCXX_3.4.9;
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {

View File

@ -1547,7 +1547,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=6:9:0
libtool_VERSION=6:10:0
# Find the rest of the source tree framework.

View File

@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=6:9:0
libtool_VERSION=6:10:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.

View File

@ -136,6 +136,11 @@
instantiation of a container is passed between the two translation
units.</p>
<p>By default, error messages are formatted to fit on lines of about
78 characters. The environment variable
<code>GLIBCXX_DEBUG_MESSAGE_LENGTH</code> can be used to request a
different length.</p>
<p>For information about the design of the libstdc++ debug mode,
please see the <a href="debug_mode.html">libstdc++ debug mode design
document</a>.</p>

View File

@ -1,6 +1,6 @@
// Debug-mode error formatting implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -359,7 +359,7 @@ namespace __gnu_debug
_Error_formatter(const char* __file, size_t __line)
: _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0),
_M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)
{ }
{ _M_get_max_length(); }
template<typename _Tp>
void
@ -371,6 +371,9 @@ namespace __gnu_debug
void
_M_print_string(const char* __string) const;
void
_M_get_max_length() const;
enum { __max_parameters = 9 };
const char* _M_file;

View File

@ -36,6 +36,7 @@
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdlib>
using namespace std;
@ -496,7 +497,8 @@ namespace __gnu_debug
_M_column += strlen(__buf);
}
_M_wordwrap = true;
if (_M_max_length)
_M_wordwrap = true;
_M_print_word("error: ");
// Print the error message
@ -671,6 +673,19 @@ namespace __gnu_debug
}
}
void
_Error_formatter::_M_get_max_length() const
{
const char* __nptr = std::getenv("GLIBCXX_DEBUG_MESSAGE_LENGTH");
if (__nptr)
{
char* __endptr;
const unsigned long __ret = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr != '\0' && *__endptr == '\0')
_M_max_length = __ret;
}
}
// Instantiations.
template
void

View File

@ -189,6 +189,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.7");
known_versions.push_back("GLIBCXX_3.4.8");
known_versions.push_back("GLIBCXX_3.4.9");
known_versions.push_back("GLIBCXX_3.4.10");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("CXXABI_1.3");