From 5dddb7e5eb8f50232da5c40fe78d8537eac5ca7e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 4 Jul 2007 00:09:22 +0000 Subject: [PATCH] re PR libstdc++/31518 (_GLIBCXX_DEBUG error message formatter line width not configurable) 2007-07-03 Paolo Carlini 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 --- libstdc++-v3/ChangeLog | 14 ++++++++++++++ libstdc++-v3/config/abi/pre/gnu.ver | 17 +++++++++++++++-- libstdc++-v3/configure | 2 +- libstdc++-v3/configure.ac | 2 +- libstdc++-v3/docs/html/debug.html | 5 +++++ libstdc++-v3/include/debug/formatter.h | 7 +++++-- libstdc++-v3/src/debug.cc | 17 ++++++++++++++++- libstdc++-v3/testsuite/util/testsuite_abi.cc | 1 + 8 files changed, 58 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6ee0d59d919..e467b5e6255 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2007-07-03 Paolo Carlini + + 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 * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 92c85e5e9f3..a7f378dd236 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -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 { diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index d58168b2e70..56368b1e5fc 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -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. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 5299480615e..bbef6c16f06 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -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. diff --git a/libstdc++-v3/docs/html/debug.html b/libstdc++-v3/docs/html/debug.html index 09a1677239c..6013115fe13 100644 --- a/libstdc++-v3/docs/html/debug.html +++ b/libstdc++-v3/docs/html/debug.html @@ -136,6 +136,11 @@ instantiation of a container is passed between the two translation units.

+

By default, error messages are formatted to fit on lines of about + 78 characters. The environment variable + GLIBCXX_DEBUG_MESSAGE_LENGTH can be used to request a + different length.

+

For information about the design of the libstdc++ debug mode, please see the libstdc++ debug mode design document.

diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h index 8975285b9d7..8a0565f708b 100644 --- a/libstdc++-v3/include/debug/formatter.h +++ b/libstdc++-v3/include/debug/formatter.h @@ -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 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; diff --git a/libstdc++-v3/src/debug.cc b/libstdc++-v3/src/debug.cc index 4129f686667..0391368a131 100644 --- a/libstdc++-v3/src/debug.cc +++ b/libstdc++-v3/src/debug.cc @@ -36,6 +36,7 @@ #include #include #include +#include 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 diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc index 64c90118821..5c49cbbe96f 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc @@ -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"); -- 2.30.2