Commit 814e52ca by François Dumont

2015-09-17 François Dumont <fdumont@gcc.gnu.org>

	* include/debug/formatter.h
	(_Error_formatter::_Parameter::_M_print_field): Deprecate.
	(_Error_formatter::_Parameter::_M_print_description): Likewise.
	(_Error_formatter::_M_format_word): Likewise.
	(_Error_formatter::_M_print_word): Likewise.
	(_Error_formatter::_M_print_string): Likewise.
	(_Error_formatter::_M_get_max_length): Likewise.
	(_Error_formatter::_M_max_length): Delete.
	(_Error_formatter::_M_indent): Likewise.
	(_Error_formatter::_M_column): Likewise.
	(_Error_formatter::_M_first_line): Likewise.
	(_Error_formatter::_M_wordwrap): Likewise.
	* src/c++11/debug.cc: Adapt.

From-SVN: r227885
parent 378b307d
2015-09-17 François Dumont <fdumont@gcc.gnu.org>
* include/debug/formatter.h
(_Error_formatter::_Parameter::_M_print_field): Deprecate.
(_Error_formatter::_Parameter::_M_print_description): Likewise.
(_Error_formatter::_M_format_word): Likewise.
(_Error_formatter::_M_print_word): Likewise.
(_Error_formatter::_M_print_string): Likewise.
(_Error_formatter::_M_get_max_length): Likewise.
(_Error_formatter::_M_max_length): Delete.
(_Error_formatter::_M_indent): Likewise.
(_Error_formatter::_M_column): Likewise.
(_Error_formatter::_M_first_line): Likewise.
(_Error_formatter::_M_wordwrap): Likewise.
* src/c++11/debug.cc: Adapt.
2015-09-17 Jonathan Wakely <jwakely@redhat.com> 2015-09-17 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/65913 PR libstdc++/65913
......
...@@ -132,6 +132,13 @@ namespace __gnu_debug ...@@ -132,6 +132,13 @@ namespace __gnu_debug
class _Error_formatter class _Error_formatter
{ {
// Tags denoting the type of parameter for construction
struct _Is_iterator { };
struct _Is_iterator_value_type { };
struct _Is_sequence { };
struct _Is_instance { };
public:
/// Whether an iterator is constant, mutable, or unknown /// Whether an iterator is constant, mutable, or unknown
enum _Constness enum _Constness
{ {
...@@ -153,13 +160,6 @@ namespace __gnu_debug ...@@ -153,13 +160,6 @@ namespace __gnu_debug
__last_state __last_state
}; };
// Tags denoting the type of parameter for construction
struct _Is_iterator { };
struct _Is_iterator_value_type { };
struct _Is_sequence { };
struct _Is_instance { };
public:
// A parameter that may be referenced by an error message // A parameter that may be referenced by an error message
struct _Parameter struct _Parameter
{ {
...@@ -375,15 +375,16 @@ namespace __gnu_debug ...@@ -375,15 +375,16 @@ namespace __gnu_debug
void void
_M_print_field(const _Error_formatter* __formatter, _M_print_field(const _Error_formatter* __formatter,
const char* __name) const; const char* __name) const _GLIBCXX_DEPRECATED;
void void
_M_print_description(const _Error_formatter* __formatter) const; _M_print_description(const _Error_formatter* __formatter)
const _GLIBCXX_DEPRECATED;
}; };
template<typename _Iterator> template<typename _Iterator>
const _Error_formatter& _Error_formatter&
_M_iterator(const _Iterator& __it, const char* __name = 0) const _M_iterator(const _Iterator& __it, const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < std::size_t(__max_parameters))
_M_parameters[_M_num_parameters++] = _Parameter(__it, __name, _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
...@@ -392,57 +393,59 @@ namespace __gnu_debug ...@@ -392,57 +393,59 @@ namespace __gnu_debug
} }
template<typename _Iterator> template<typename _Iterator>
const _Error_formatter& _Error_formatter&
_M_iterator_value_type(const _Iterator& __it, _M_iterator_value_type(const _Iterator& __it,
const char* __name = 0) const const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _M_parameters[_M_num_parameters++] =
_Parameter(__it, __name, _Is_iterator_value_type()); _Parameter(__it, __name, _Is_iterator_value_type());
return *this; return *this;
} }
const _Error_formatter& _Error_formatter&
_M_integer(long __value, const char* __name = 0) const _M_integer(long __value, const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name); _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this; return *this;
} }
const _Error_formatter& _Error_formatter&
_M_string(const char* __value, const char* __name = 0) const _M_string(const char* __value, const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _Parameter(__value, __name); _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
return *this; return *this;
} }
template<typename _Sequence> template<typename _Sequence>
const _Error_formatter& _Error_formatter&
_M_sequence(const _Sequence& __seq, const char* __name = 0) const _M_sequence(const _Sequence& __seq, const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
_Is_sequence()); _Is_sequence());
return *this; return *this;
} }
template<typename _Type> template<typename _Type>
const _Error_formatter& _Error_formatter&
_M_instance(const _Type& __inst, const char* __name = 0) const _M_instance(const _Type& __inst, const char* __name = 0)
{ {
if (_M_num_parameters < std::size_t(__max_parameters)) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _Parameter(__inst, __name, _M_parameters[_M_num_parameters++] = _Parameter(__inst, __name,
_Is_instance()); _Is_instance());
return *this; return *this;
} }
const _Error_formatter& _Error_formatter&
_M_message(const char* __text) const _M_message(const char* __text)
{ _M_text = __text; return *this; } { _M_text = __text; return *this; }
const _Error_formatter& // Kept const qualifier for backward compatibility, to keep the same
// exported symbol.
_Error_formatter&
_M_message(_Debug_msg_id __id) const throw (); _M_message(_Debug_msg_id __id) const throw ();
_GLIBCXX_NORETURN void _GLIBCXX_NORETURN void
...@@ -450,40 +453,38 @@ namespace __gnu_debug ...@@ -450,40 +453,38 @@ namespace __gnu_debug
template<typename _Tp> template<typename _Tp>
void void
_M_format_word(char*, int, const char*, _Tp) const throw (); _M_format_word(char*, int, const char*, _Tp)
const throw () _GLIBCXX_DEPRECATED;
void void
_M_print_word(const char* __word) const; _M_print_word(const char* __word) const _GLIBCXX_DEPRECATED;
void void
_M_print_string(const char* __string) const; _M_print_string(const char* __string) const _GLIBCXX_DEPRECATED;
private: private:
_Error_formatter(const char* __file, std::size_t __line) _Error_formatter(const char* __file, unsigned int __line)
: _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0), : _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(); }
void void
_M_get_max_length() const throw (); _M_get_max_length() const throw () _GLIBCXX_DEPRECATED;
enum { __max_parameters = 9 }; enum { __max_parameters = 9 };
const char* _M_file; const char* _M_file;
std::size_t _M_line; unsigned int _M_line;
mutable _Parameter _M_parameters[__max_parameters]; _Parameter _M_parameters[__max_parameters];
mutable std::size_t _M_num_parameters; unsigned int _M_num_parameters;
mutable const char* _M_text; const char* _M_text;
mutable std::size_t _M_max_length;
enum { _M_indent = 4 } ;
mutable std::size_t _M_column;
mutable bool _M_first_line;
mutable bool _M_wordwrap;
public: public:
static _Error_formatter static _Error_formatter&
_M_at(const char* __file, std::size_t __line) _M_at(const char* __file, unsigned int __line)
{ return _Error_formatter(__file, __line); } {
static _Error_formatter __formatter(__file, __line);
return __formatter;
}
}; };
} // namespace __gnu_debug } // namespace __gnu_debug
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment