{
"function requires a valid iterator range [%1.name;, %2.name;)",
"attempt to insert into container with a singular iterator",
- "attempt to insert into container with an iterator from a different container",
+ "attempt to insert into container with an iterator"
+ " from a different container",
"attempt to erase from container with a %2.state; iterator",
- "attempt to erase from container with an iterator from a different container",
- "attempt to subscript container with out-of-bounds index %2;, but container only holds %3; elements",
+ "attempt to erase from container with an iterator"
+ " from a different container",
+ "attempt to subscript container with out-of-bounds index %2;,"
+ " but container only holds %3; elements",
"attempt to access an element in an empty container",
- "elements in iterator range [%1.name;, %2.name;) are not partitioned by the value %3;",
- "elements in iterator range [%1.name;, %2.name;) are not partitioned by the predicate %3; and value %4;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the value %3;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the predicate %3; and value %4;",
"elements in iterator range [%1.name;, %2.name;) are not sorted",
- "elements in iterator range [%1.name;, %2.name;) are not sorted according to the predicate %3;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not sorted according to the predicate %3;",
"elements in iterator range [%1.name;, %2.name;) do not form a heap",
- "elements in iterator range [%1.name;, %2.name;) do not form a heap with respect to the predicate %3;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " do not form a heap with respect to the predicate %3;",
"attempt to write through a singular bitset reference",
"attempt to read from a singular bitset reference",
"attempt to flip a singular bitset reference",
"attempt to splice lists with inequal allocators",
"attempt to splice elements referenced by a %1.state; iterator",
"attempt to splice an iterator from a different container",
- "splice destination %1.name; occurs within source range [%2.name;, %3.name;)",
+ "splice destination %1.name;"
+ " occurs within source range [%2.name;, %3.name;)",
"attempt to initialize an iterator that will immediately become singular",
"attempt to copy-construct an iterator from a singular iterator",
- "attempt to construct a constant iterator from a singular mutable iterator",
+ "attempt to construct a constant iterator"
+ " from a singular mutable iterator",
"attempt to copy from a singular iterator",
"attempt to dereference a %1.state; iterator",
"attempt to increment a %1.state; iterator",
"attempt to decrement a %1.state; iterator",
- "attempt to subscript a %1.state; iterator %2; step from its current position, which falls outside its dereferenceable range",
- "attempt to advance a %1.state; iterator %2; steps, which falls outside its valid range",
- "attempt to retreat a %1.state; iterator %2; steps, which falls outside its valid range",
+ "attempt to subscript a %1.state; iterator %2; step from"
+ " its current position, which falls outside its dereferenceable range",
+ "attempt to advance a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
+ "attempt to retreat a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
"attempt to compare a %1.state; iterator to a %2.state; iterator",
"attempt to compare iterators from different sequences",
"attempt to order a %1.state; iterator to a %2.state; iterator",
"attempt to order iterators from different sequences",
- "attempt to compute the difference between a %1.state; iterator to a %2.state; iterator",
- "attempt to compute the different between two iterators from different sequences",
+ "attempt to compute the difference between a %1.state;"
+ " iterator to a %2.state; iterator",
+ "attempt to compute the different between two iterators"
+ " from different sequences",
"attempt to dereference an end-of-stream istream_iterator",
"attempt to increment an end-of-stream istream_iterator",
"attempt to output via an ostream_iterator with no associated stream",
- "attempt to dereference an end-of-stream istreambuf_iterator (this is a GNU extension)",
+ "attempt to dereference an end-of-stream istreambuf_iterator"
+ " (this is a GNU extension)",
"attempt to increment an end-of-stream istreambuf_iterator"
};
_M_detach_all()
{
for (_Safe_iterator_base* iter = _M_iterators; iter; )
- {
- _Safe_iterator_base* old = iter;
- iter = iter->_M_next;
- old->_M_attach(0, false);
- }
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ old->_M_attach(0, false);
+ }
for (_Safe_iterator_base* iter = _M_const_iterators; iter; )
- {
- _Safe_iterator_base* old = iter;
- iter = iter->_M_next;
- old->_M_attach(0, true);
- }
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ old->_M_attach(0, true);
+ }
}
void
_M_detach_singular()
{
for (_Safe_iterator_base* iter = _M_iterators; iter; )
- {
- _Safe_iterator_base* old = iter;
- iter = iter->_M_next;
- if (old->_M_singular())
- old->_M_attach(0, false);
- }
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ if (old->_M_singular())
+ old->_M_attach(0, false);
+ }
for (_Safe_iterator_base* iter = _M_const_iterators; iter; )
- {
- _Safe_iterator_base* old = iter;
- iter = iter->_M_next;
- if (old->_M_singular())
- old->_M_attach(0, true);
- }
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ if (old->_M_singular())
+ old->_M_attach(0, true);
+ }
}
-
+
void
_Safe_sequence_base::
_M_revalidate_singular()
{
- for (_Safe_iterator_base* iter = _M_iterators; iter;
- iter = iter->_M_next)
- {
- iter->_M_version = _M_version;
- iter = iter->_M_next;
- }
+ _Safe_iterator_base* iter;
+ for (iter = _M_iterators; iter; iter = iter->_M_next)
+ {
+ iter->_M_version = _M_version;
+ iter = iter->_M_next;
+ }
- for (_Safe_iterator_base* iter = _M_const_iterators; iter;
- iter = iter->_M_next)
- {
- iter->_M_version = _M_version;
- iter = iter->_M_next;
- }
+ for (iter = _M_const_iterators; iter; iter = iter->_M_next)
+ {
+ iter->_M_version = _M_version;
+ iter = iter->_M_next;
+ }
}
void
swap(_M_iterators, __x._M_iterators);
swap(_M_const_iterators, __x._M_const_iterators);
swap(_M_version, __x._M_version);
- for (_Safe_iterator_base* iter = _M_iterators; iter; iter = iter->_M_next)
+ _Safe_iterator_base* iter;
+ for (iter = _M_iterators; iter; iter = iter->_M_next)
iter->_M_sequence = this;
- for (_Safe_iterator_base* iter = __x._M_iterators; iter; iter = iter->_M_next)
+ for (iter = __x._M_iterators; iter; iter = iter->_M_next)
iter->_M_sequence = &__x;
- for (_Safe_iterator_base* iter = _M_const_iterators; iter; iter = iter->_M_next)
+ for (iter = _M_const_iterators; iter; iter = iter->_M_next)
iter->_M_sequence = this;
- for (_Safe_iterator_base* iter = __x._M_const_iterators; iter; iter = iter->_M_next)
+ for (iter = __x._M_const_iterators; iter; iter = iter->_M_next)
iter->_M_sequence = &__x;
}
// Attach to the new sequence (if there is one)
if (__seq)
- {
- _M_sequence = __seq;
- _M_version = _M_sequence->_M_version;
- _M_prior = 0;
- if (__constant)
- {
- _M_next = _M_sequence->_M_const_iterators;
- if (_M_next)
- _M_next->_M_prior = this;
- _M_sequence->_M_const_iterators = this;
- }
- else
{
- _M_next = _M_sequence->_M_iterators;
- if (_M_next)
- _M_next->_M_prior = this;
- _M_sequence->_M_iterators = this;
+ _M_sequence = __seq;
+ _M_version = _M_sequence->_M_version;
+ _M_prior = 0;
+ if (__constant)
+ {
+ _M_next = _M_sequence->_M_const_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_const_iterators = this;
+ }
+ else
+ {
+ _M_next = _M_sequence->_M_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_iterators = this;
+ }
}
- }
}
void
_M_detach()
{
if (_M_sequence)
- {
- // Remove us from this sequence's list
- if (_M_prior) _M_prior->_M_next = _M_next;
- if (_M_next) _M_next->_M_prior = _M_prior;
-
- if (_M_sequence->_M_const_iterators == this)
- _M_sequence->_M_const_iterators = _M_next;
- if (_M_sequence->_M_iterators == this)
- _M_sequence->_M_iterators = _M_next;
- }
+ {
+ // Remove us from this sequence's list
+ if (_M_prior)
+ _M_prior->_M_next = _M_next;
+ if (_M_next)
+ _M_next->_M_prior = _M_prior;
+
+ if (_M_sequence->_M_const_iterators == this)
+ _M_sequence->_M_const_iterators = _M_next;
+ if (_M_sequence->_M_iterators == this)
+ _M_sequence->_M_iterators = _M_next;
+ }
_M_sequence = 0;
_M_version = 0;
_Safe_iterator_base::
_M_can_compare(const _Safe_iterator_base& __x) const
{
- return (! _M_singular() && !__x._M_singular()
+ return (!_M_singular() && !__x._M_singular()
&& _M_sequence == __x._M_sequence);
}
void
_Error_formatter::_Parameter::
- _M_print_field(const _Error_formatter* __formatter,
- const char* __name) const
+ _M_print_field(const _Error_formatter* __formatter, const char* __name) const
{
assert(this->_M_kind != _Parameter::__unused_param);
const int bufsize = 64;
char buf[bufsize];
if (_M_kind == __iterator)
- {
- if (strcmp(__name, "name") == 0)
- {
- assert(_M_variant._M_iterator._M_name);
- __formatter->_M_print_word(_M_variant._M_iterator._M_name);
- }
- else if (strcmp(__name, "address") == 0)
- {
- snprintf(buf, bufsize, "%p", _M_variant._M_iterator._M_address);
- __formatter->_M_print_word(buf);
- }
- else if (strcmp(__name, "type") == 0)
- {
- assert(_M_variant._M_iterator._M_type);
- // TBD: demangle!
- __formatter->_M_print_word(_M_variant._M_iterator._M_type->name());
- }
- else if (strcmp(__name, "constness") == 0)
- {
- static const char* __constness_names[__last_constness] =
- {
- "<unknown>",
- "constant",
- "mutable"
- };
- __formatter->_M_print_word(__constness_names[_M_variant._M_iterator._M_constness]);
- }
- else if (strcmp(__name, "state") == 0)
- {
- static const char* __state_names[__last_state] =
- {
- "<unknown>",
- "singular",
- "dereferenceable (start-of-sequence)",
- "dereferenceable",
- "past-the-end"
- };
- __formatter->_M_print_word(__state_names[_M_variant._M_iterator._M_state]);
- }
- else if (strcmp(__name, "sequence") == 0)
{
- assert(_M_variant._M_iterator._M_sequence);
- snprintf(buf, bufsize, "%p", _M_variant._M_iterator._M_sequence);
- __formatter->_M_print_word(buf);
- }
- else if (strcmp(__name, "seq_type") == 0)
- {
- // TBD: demangle!
- assert(_M_variant._M_iterator._M_seq_type);
- __formatter->_M_print_word(_M_variant._M_iterator._M_seq_type->name());
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_iterator._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ assert(_M_variant._M_iterator._M_type);
+ // TBD: demangle!
+ __formatter->_M_print_word(_M_variant._M_iterator._M_type->name());
+ }
+ else if (strcmp(__name, "constness") == 0)
+ {
+ static const char* __constness_names[__last_constness] =
+ {
+ "<unknown>",
+ "constant",
+ "mutable"
+ };
+ __formatter->_M_print_word(__constness_names[_M_variant._M_iterator._M_constness]);
+ }
+ else if (strcmp(__name, "state") == 0)
+ {
+ static const char* __state_names[__last_state] =
+ {
+ "<unknown>",
+ "singular",
+ "dereferenceable (start-of-sequence)",
+ "dereferenceable",
+ "past-the-end"
+ };
+ __formatter->_M_print_word(__state_names[_M_variant._M_iterator._M_state]);
+ }
+ else if (strcmp(__name, "sequence") == 0)
+ {
+ assert(_M_variant._M_iterator._M_sequence);
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_iterator._M_sequence);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "seq_type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_iterator._M_seq_type);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_seq_type->name());
+ }
+ else
+ assert(false);
}
- else
- assert(false);
- }
else if (_M_kind == __sequence)
- {
- if (strcmp(__name, "name") == 0)
- {
- assert(_M_variant._M_sequence._M_name);
- __formatter->_M_print_word(_M_variant._M_sequence._M_name);
- }
- else if (strcmp(__name, "address") == 0)
- {
- assert(_M_variant._M_sequence._M_address);
- snprintf(buf, bufsize, "%p", _M_variant._M_sequence._M_address);
- __formatter->_M_print_word(buf);
- }
- else if (strcmp(__name, "type") == 0)
{
- // TBD: demangle!
- assert(_M_variant._M_sequence._M_type);
- __formatter->_M_print_word(_M_variant._M_sequence._M_type->name());
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ assert(_M_variant._M_sequence._M_address);
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_sequence._M_type);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_type->name());
+ }
+ else
+ assert(false);
}
- else
- assert(false);
- }
else if (_M_kind == __integer)
- {
- if (strcmp(__name, "name") == 0)
{
- assert(_M_variant._M_integer._M_name);
- __formatter->_M_print_word(_M_variant._M_integer._M_name);
- }
- else
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_integer._M_name);
+ __formatter->_M_print_word(_M_variant._M_integer._M_name);
+ }
+ else
assert(false);
- }
+ }
else if (_M_kind == __string)
- {
- if (strcmp(__name, "name") == 0)
{
- assert(_M_variant._M_string._M_name);
- __formatter->_M_print_word(_M_variant._M_string._M_name);
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_string._M_name);
+ __formatter->_M_print_word(_M_variant._M_string._M_name);
+ }
+ else
+ assert(false);
}
- else
- assert(false);
- }
else
- {
- assert(false);
- }
+ {
+ assert(false);
+ }
}
-
+
void
_Error_formatter::_Parameter::
_M_print_description(const _Error_formatter* __formatter) const
char buf[bufsize];
if (_M_kind == __iterator)
- {
- __formatter->_M_print_word("iterator ");
- if (_M_variant._M_iterator._M_name)
{
- snprintf(buf, bufsize, "\"%s\" ",
- _M_variant._M_iterator._M_name);
+ __formatter->_M_print_word("iterator ");
+ if (_M_variant._M_iterator._M_name)
+ {
+ __formatter->_M_format_word(buf, bufsize, "\"%s\" ",
+ _M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(buf);
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p {\n",
+ _M_variant._M_iterator._M_address);
__formatter->_M_print_word(buf);
- }
-
- snprintf(buf, bufsize, "@ 0x%p {\n",
- _M_variant._M_iterator._M_address);
- __formatter->_M_print_word(buf);
- if (_M_variant._M_iterator._M_type)
- {
- __formatter->_M_print_word("type = ");
- _M_print_field(__formatter, "type");
+ if (_M_variant._M_iterator._M_type)
+ {
+ __formatter->_M_print_word("type = ");
+ _M_print_field(__formatter, "type");
+
+ if (_M_variant._M_iterator._M_constness != __unknown_constness)
+ {
+ __formatter->_M_print_word(" (");
+ _M_print_field(__formatter, "constness");
+ __formatter->_M_print_word(" iterator)");
+ }
+ __formatter->_M_print_word(";\n");
+ }
- if (_M_variant._M_iterator._M_constness != __unknown_constness)
- {
- __formatter->_M_print_word(" (");
- _M_print_field(__formatter, "constness");
- __formatter->_M_print_word(" iterator)");
- }
- __formatter->_M_print_word(";\n");
- }
-
- if (_M_variant._M_iterator._M_state != __unknown_state)
- {
- __formatter->_M_print_word(" state = ");
- _M_print_field(__formatter, "state");
- __formatter->_M_print_word(";\n");
- }
-
- if (_M_variant._M_iterator._M_sequence)
- {
- __formatter->_M_print_word(" references sequence ");
- if (_M_variant._M_iterator._M_seq_type)
- {
- __formatter->_M_print_word("with type `");
- _M_print_field(__formatter, "seq_type");
- __formatter->_M_print_word("' ");
- }
+ if (_M_variant._M_iterator._M_state != __unknown_state)
+ {
+ __formatter->_M_print_word(" state = ");
+ _M_print_field(__formatter, "state");
+ __formatter->_M_print_word(";\n");
+ }
- snprintf(buf, bufsize, "@ 0x%p\n", _M_variant._M_sequence._M_address);
- __formatter->_M_print_word(buf);
+ if (_M_variant._M_iterator._M_sequence)
+ {
+ __formatter->_M_print_word(" references sequence ");
+ if (_M_variant._M_iterator._M_seq_type)
+ {
+ __formatter->_M_print_word("with type `");
+ _M_print_field(__formatter, "seq_type");
+ __formatter->_M_print_word("' ");
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p\n",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ __formatter->_M_print_word("}\n");
}
- __formatter->_M_print_word("}\n");
- }
else if (_M_kind == __sequence)
- {
- __formatter->_M_print_word("sequence ");
- if (_M_variant._M_sequence._M_name)
{
- snprintf(buf, bufsize, "\"%s\" ",
- _M_variant._M_sequence._M_name);
+ __formatter->_M_print_word("sequence ");
+ if (_M_variant._M_sequence._M_name)
+ {
+ __formatter->_M_format_word(buf, bufsize, "\"%s\" ",
+ _M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(buf);
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p {\n",
+ _M_variant._M_sequence._M_address);
__formatter->_M_print_word(buf);
+
+ if (_M_variant._M_sequence._M_type)
+ {
+ __formatter->_M_print_word(" type = ");
+ _M_print_field(__formatter, "type");
+ __formatter->_M_print_word(";\n");
+ }
+ __formatter->_M_print_word("}\n");
}
-
- snprintf(buf, bufsize, "@ 0x%p {\n",
- _M_variant._M_sequence._M_address);
- __formatter->_M_print_word(buf);
-
- if (_M_variant._M_sequence._M_type)
- {
- __formatter->_M_print_word(" type = ");
- _M_print_field(__formatter, "type");
- __formatter->_M_print_word(";\n");
- }
- __formatter->_M_print_word("}\n");
- }
}
const _Error_formatter&
_M_column = 1;
_M_wordwrap = false;
if (_M_file)
- {
- snprintf(buf, bufsize, "%s:", _M_file);
- _M_print_word(buf);
- _M_column += strlen(buf);
- }
+ {
+ _M_format_word(buf, bufsize, "%s:", _M_file);
+ _M_print_word(buf);
+ _M_column += strlen(buf);
+ }
if (_M_line > 0)
- {
- snprintf(buf, bufsize, "%u:", _M_line);
- _M_print_word(buf);
- _M_column += strlen(buf);
- }
+ {
+ _M_format_word(buf, bufsize, "%u:", _M_line);
+ _M_print_word(buf);
+ _M_column += strlen(buf);
+ }
_M_wordwrap = true;
_M_print_word("error: ");
_M_wordwrap = false;
bool has_noninteger_parameters = false;
for (unsigned int i = 0; i < _M_num_parameters; ++i)
- {
- if (_M_parameters[i]._M_kind == _Parameter::__iterator
- || _M_parameters[i]._M_kind == _Parameter::__sequence)
{
- if (!has_noninteger_parameters)
- {
- _M_first_line = true;
- _M_print_word("\nObjects involved in the operation:\n");
- has_noninteger_parameters = true;
- }
- _M_parameters[i]._M_print_description(this);
+ if (_M_parameters[i]._M_kind == _Parameter::__iterator
+ || _M_parameters[i]._M_kind == _Parameter::__sequence)
+ {
+ if (!has_noninteger_parameters)
+ {
+ _M_first_line = true;
+ _M_print_word("\nObjects involved in the operation:\n");
+ has_noninteger_parameters = true;
+ }
+ _M_parameters[i]._M_print_description(this);
+ }
}
- }
abort();
}
+ template<typename _T>
+ void
+ _Error_formatter::_M_format_word(char* __buf,
+ int __n __attribute__((__unused__)),
+ const char* __fmt, _T __s) const
+ {
+#ifdef _GLIBCXX_USE_C99
+ std::snprintf(__buf, __n, __fmt, __s);
+#else
+ std::sprintf(__buf, __fmt, __s);
+#endif
+ }
+
+
void
_Error_formatter::_M_print_word(const char* __word) const
{
if (!_M_wordwrap)
- {
- fprintf(stderr, "%s", __word);
- return;
- }
+ {
+ fprintf(stderr, "%s", __word);
+ return;
+ }
size_t __length = strlen(__word);
if (__length == 0)
if ((_M_column + __length < _M_max_length)
|| (__length >= _M_max_length && _M_column == 1))
- {
- // If this isn't the first line, indent
- if (_M_column == 1 && !_M_first_line)
{
- char spacing[_M_indent + 1];
- for (int i = 0; i < _M_indent; ++i)
- spacing[i] = ' ';
- spacing[_M_indent] = '\0';
- fprintf(stderr, "%s", spacing);
- _M_column += _M_indent;
+ // If this isn't the first line, indent
+ if (_M_column == 1 && !_M_first_line)
+ {
+ char spacing[_M_indent + 1];
+ for (int i = 0; i < _M_indent; ++i)
+ spacing[i] = ' ';
+ spacing[_M_indent] = '\0';
+ fprintf(stderr, "%s", spacing);
+ _M_column += _M_indent;
+ }
+
+ fprintf(stderr, "%s", __word);
+ _M_column += __length;
+
+ if (__word[__length - 1] == '\n')
+ {
+ _M_first_line = false;
+ _M_column = 1;
+ }
}
-
- fprintf(stderr, "%s", __word);
- _M_column += __length;
-
- if (__word[__length - 1] == '\n')
+ else
{
- _M_first_line = false;
_M_column = 1;
+ _M_print_word("\n");
+ _M_print_word(__word);
}
- }
- else
- {
- _M_column = 1;
- _M_print_word("\n");
- _M_print_word(__word);
- }
}
void
char buf[bufsize];
while (*__start)
- {
- if (*__start != '%')
{
- // [__start, __end) denotes the next word
- __end = __start;
- while (isalnum(*__end)) ++__end;
- if (__start == __end) ++__end;
- if (isspace(*__end)) ++__end;
-
- assert(__end - __start + 1< bufsize);
- snprintf(buf, __end - __start + 1, "%s", __start);
- _M_print_word(buf);
- __start = __end;
-
- // Skip extra whitespace
- while (*__start == ' ') ++__start;
-
- continue;
- }
+ if (*__start != '%')
+ {
+ // [__start, __end) denotes the next word
+ __end = __start;
+ while (isalnum(*__end)) ++__end;
+ if (__start == __end) ++__end;
+ if (isspace(*__end)) ++__end;
+
+ assert(__end - __start + 1< bufsize);
+ _M_format_word(buf, __end - __start + 1, "%s", __start);
+ _M_print_word(buf);
+ __start = __end;
+
+ // Skip extra whitespace
+ while (*__start == ' ')
+ ++__start;
+
+ continue;
+ }
++__start;
assert(*__start);
if (*__start == '%')
- {
- _M_print_word("%");
- ++__start;
- continue;
- }
+ {
+ _M_print_word("%");
+ ++__start;
+ continue;
+ }
// Get the parameter number
assert(*__start >= '1' && *__start <= '9');
// name, if there is one.
++__start;
if (*__start != '.')
- {
+ {
assert(*__start == ';');
++__start;
buf[0] = '\0';
if (_M_parameters[param]._M_kind == _Parameter::__integer)
{
- snprintf(buf, bufsize, "%ld",
- _M_parameters[param]._M_variant._M_integer._M_value);
+ _M_format_word(buf, bufsize, "%ld",
+ _M_parameters[param]._M_variant._M_integer._M_value);
_M_print_word(buf);
}
else if (_M_parameters[param]._M_kind == _Parameter::__string)
_M_parameters[param]._M_print_field(this, field);
}
}
+
+ // Instantiations.
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const void* __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ long __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ unsigned int __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const char* __s) const;
} // namespace __gnu_debug