Commit 8fbc5ae7 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (lang_type_class): Remove is_partial_instantiation.

	* cp-tree.h (lang_type_class): Remove is_partial_instantiation.
	(PARTIAL_INSTANTIATION_P): Remove.
	(IMPLICIT_TYPENAME_P): Likewise.
	(IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise.
	(build_typename_type): Remove declaration.
	(parmlist_is_exprlist): Likewise.
	* decl.c (build_typename_type): Make it static, remove third
	parameter.
	(push_class_binding): Don't do implicit typename stuff.
	(make_typename_type): Likewise.
	(lookup_name_real): Likewise.
	(grokdeclarator): Don't try to convert declarations into
	initializations.  Don't do implicit typename stuff.
	(parmlist_is_exprlist): Remove.
	(xref_basetypes): Simplify.
	* decl2.c (grokfield): Don't try to convert declarations into
	initializations.
	(build_anon_union_vars): Do this while processing templates, too.
	(finish_anon_union): Likewise.
	* error.c (dump_type): Remove implicit typename handling.
	* parser.c (cp_parser_diagnose_invalid_type_name): New method.
	(cp_parser_primary_expression): Correct handling of names not
	found by unqualified name lookup in templates.
	(cp_parser_nested_name_specifier_opt): Avoid checking dependency
	of types when possible.
	(cp_parser_simple_declaration): Complain intelligently about some
	invalid declarations.
	(cp_parser_member_declaration): Likewise.
	(cp_parser_constructor_declarator_p): Don't check when we're in a
	function scope.
	* pt.c (instantiate_class_template): Remove
	PARTIAL_INSTANTIATION_P gunk.
	* search.c (lookup_field_r): Don't build implicit typenames.
	(marked_pushdecls_p): Don't enter dependent base types.
	(unmarked_pushdecls_p): Likewise.
	* semantics.c (begin_class_definition): Remove implicit typename
	stuff.

	* config/locale/gnu/messages_members.h: Use this-> to refer to
	unqualified members of base clasess.
	* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Likewise.
	* include/bits/codecvt.h: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/fstream.tcc: Likewise.
	* include/bits/istream.tcc: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/locale_facets.h: Likewise.
	* include/bits/ostream.tcc: Likewise.
	* include/bits/sstream.tcc: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/ext/stdio_filebuf.h: Likewise.
	* include/ext/stl_rope.h: Likewise.
	* include/std/std_fstream.h: Likewise.
	* include/std/std_sstream.h: Likewise.

Co-Authored-By: Jeffrey Oldham <oldham@codesourcery.com>

From-SVN: r61403
parent 07488f32
2003-01-16 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (lang_type_class): Remove is_partial_instantiation.
(PARTIAL_INSTANTIATION_P): Remove.
(IMPLICIT_TYPENAME_P): Likewise.
(IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise.
(build_typename_type): Remove declaration.
(parmlist_is_exprlist): Likewise.
* decl.c (build_typename_type): Make it static, remove third
parameter.
(push_class_binding): Don't do implicit typename stuff.
(make_typename_type): Likewise.
(lookup_name_real): Likewise.
(grokdeclarator): Don't try to convert declarations into
initializations. Don't do implicit typename stuff.
(parmlist_is_exprlist): Remove.
(xref_basetypes): Simplify.
* decl2.c (grokfield): Don't try to convert declarations into
initializations.
(build_anon_union_vars): Do this while processing templates, too.
(finish_anon_union): Likewise.
* error.c (dump_type): Remove implicit typename handling.
* parser.c (cp_parser_diagnose_invalid_type_name): New method.
(cp_parser_primary_expression): Correct handling of names not
found by unqualified name lookup in templates.
(cp_parser_nested_name_specifier_opt): Avoid checking dependency
of types when possible.
(cp_parser_simple_declaration): Complain intelligently about some
invalid declarations.
(cp_parser_member_declaration): Likewise.
(cp_parser_constructor_declarator_p): Don't check when we're in a
function scope.
* pt.c (instantiate_class_template): Remove
PARTIAL_INSTANTIATION_P gunk.
* search.c (lookup_field_r): Don't build implicit typenames.
(marked_pushdecls_p): Don't enter dependent base types.
(unmarked_pushdecls_p): Likewise.
* semantics.c (begin_class_definition): Remove implicit typename
stuff.
2003-01-16 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9212
......
......@@ -1133,6 +1133,7 @@ struct lang_type_class GTY(())
unsigned has_arrow_overloaded : 1;
unsigned interface_only : 1;
unsigned interface_unknown : 1;
unsigned contains_empty_class_p : 1;
unsigned marks: 6;
unsigned vec_new_uses_cookie : 1;
......@@ -1152,13 +1153,11 @@ struct lang_type_class GTY(())
unsigned has_complex_assign_ref : 1;
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
unsigned is_partial_instantiation : 1;
unsigned java_interface : 1;
unsigned anon_aggr : 1;
unsigned non_zero_init : 1;
unsigned empty_p : 1;
unsigned contains_empty_class_p : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
......@@ -1167,7 +1166,7 @@ struct lang_type_class GTY(())
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
unsigned dummy : 5;
unsigned dummy : 6;
tree primary_base;
tree vfields;
......@@ -2412,17 +2411,6 @@ struct lang_decl GTY(())
TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
#define TYPENAME_TYPE_FULLNAME(NODE) (TYPE_FIELDS (NODE))
/* Nonzero if NODE is an implicit typename. */
#define IMPLICIT_TYPENAME_P(NODE) \
(TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
/* Nonzero if NODE is a TYPE_DECL that should not be visible because
it is from a dependent base class. */
#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL \
&& DECL_ARTIFICIAL (NODE) \
&& IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
/* Nonzero in INTEGER_CST means that this int is negative by dint of
using a twos-complement negated operand. */
#define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
......@@ -2908,12 +2896,6 @@ struct lang_decl GTY(())
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
(DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
/* Nonzero if TYPE is a partial instantiation of a template class,
i.e., an instantiation whose instantiation arguments involve
template types. */
#define PARTIAL_INSTANTIATION_P(TYPE) \
(LANG_TYPE_CLASS_CHECK (TYPE)->is_partial_instantiation)
/* Nonzero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
full specialization. */
......@@ -3765,7 +3747,6 @@ extern tree binding_for_name (tree, tree);
extern tree namespace_binding (tree, tree);
extern void set_namespace_binding (tree, tree, tree);
extern tree lookup_namespace_name (tree, tree);
extern tree build_typename_type (tree, tree, tree, tree);
extern tree make_typename_type (tree, tree, tsubst_flags_t);
extern tree make_unbound_class_template (tree, tree, tsubst_flags_t);
extern tree lookup_name_nonclass (tree);
......@@ -3800,7 +3781,6 @@ extern int complete_array_type (tree, tree, int);
extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
extern int parmlist_is_exprlist (tree);
extern int copy_fn_p (tree);
extern tree get_scope_of_declarator (tree);
extern void grok_special_member_properties (tree);
......
......@@ -846,35 +846,6 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
const char *asmspec = 0;
int flags = LOOKUP_ONLYCONVERTING;
/* Convert () initializers to = initializers. */
if (init == NULL_TREE && declarator != NULL_TREE
&& TREE_CODE (declarator) == CALL_EXPR
&& TREE_OPERAND (declarator, 0)
&& (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE
|| TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
&& parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
{
/* It's invalid to try to initialize a data member using a
functional notation, e.g.:
struct S {
static int i (3);
};
Explain that to the user. */
static int explained;
error ("invalid data member initialization");
if (!explained)
{
error ("(use `=' to initialize static data members)");
explained = 1;
}
declarator = TREE_OPERAND (declarator, 0);
flags = 0;
}
if (declspecs == NULL_TREE
&& TREE_CODE (declarator) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
......@@ -1280,8 +1251,11 @@ build_anon_union_vars (tree object)
else if (TREE_PROTECTED (field))
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
ref = build_class_member_access_expr (object, field, NULL_TREE,
false);
if (processing_template_decl)
ref = build_min_nt (COMPONENT_REF, object, DECL_NAME (field));
else
ref = build_class_member_access_expr (object, field, NULL_TREE,
false);
if (DECL_NAME (field))
{
......@@ -1327,16 +1301,15 @@ finish_anon_union (tree anon_union_decl)
return;
}
if (!processing_template_decl)
main_decl = build_anon_union_vars (anon_union_decl);
if (main_decl == NULL_TREE)
{
main_decl = build_anon_union_vars (anon_union_decl);
if (main_decl == NULL_TREE)
{
warning ("anonymous union with no members");
return;
}
warning ("anonymous union with no members");
return;
}
if (!processing_template_decl)
{
/* Use main_decl to set the mangled name. */
DECL_NAME (anon_union_decl) = DECL_NAME (main_decl);
mangle_decl (anon_union_decl);
......
......@@ -454,8 +454,7 @@ dump_type (t, flags)
break;
}
case TYPENAME_TYPE:
if (!IMPLICIT_TYPENAME_P (t))
output_add_string (scratch_buffer, "typename ");
output_add_string (scratch_buffer, "typename ");
dump_typename (t, flags);
break;
......
......@@ -1758,6 +1758,8 @@ static bool cp_parser_simulate_error
PARAMS ((cp_parser *));
static void cp_parser_check_type_definition
PARAMS ((cp_parser *));
static bool cp_parser_diagnose_invalid_type_name
(cp_parser *);
static bool cp_parser_skip_to_closing_parenthesis
PARAMS ((cp_parser *));
static bool cp_parser_skip_to_closing_parenthesis_or_comma
......@@ -2201,6 +2203,83 @@ cp_parser_check_type_definition (parser)
error ("%s", parser->type_definition_forbidden_message);
}
/* Check for a common situation where a type-name should be present,
but is not, and issue a sensible error message. Returns true if an
invalid type-name was detected. */
static bool
cp_parser_diagnose_invalid_type_name (cp_parser *parser)
{
/* If the next two tokens are both identifiers, the code is
erroneous. The usual cause of this situation is code like:
T t;
where "T" should name a type -- but does not. */
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
&& cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_NAME)
{
tree name;
/* If parsing tenatively, we should commit; we really are
looking at a declaration. */
/* Consume the first identifier. */
name = cp_lexer_consume_token (parser->lexer)->value;
/* Issue an error message. */
error ("`%s' does not name a type", IDENTIFIER_POINTER (name));
/* If we're in a template class, it's possible that the user was
referring to a type from a base class. For example:
template <typename T> struct A { typedef T X; };
template <typename T> struct B : public A<T> { X x; };
The user should have said "typename A<T>::X". */
if (processing_template_decl && current_class_type)
{
tree b;
for (b = TREE_CHAIN (TYPE_BINFO (current_class_type));
b;
b = TREE_CHAIN (b))
{
tree base_type = BINFO_TYPE (b);
if (CLASS_TYPE_P (base_type)
&& cp_parser_dependent_type_p (base_type))
{
tree field;
/* Go from a particular instantiation of the
template (which will have an empty TYPE_FIELDs),
to the main version. */
if (CLASSTYPE_USE_TEMPLATE (base_type))
base_type = (TREE_TYPE
(DECL_TEMPLATE_RESULT
(DECL_PRIMARY_TEMPLATE
(CLASSTYPE_TI_TEMPLATE (base_type)))));
for (field = TYPE_FIELDS (base_type);
field;
field = TREE_CHAIN (field))
if (TREE_CODE (field) == TYPE_DECL
&& DECL_NAME (field) == name)
{
error ("(perhaps `typename %T::%s' was intended)",
BINFO_TYPE (b), IDENTIFIER_POINTER (name));
break;
}
if (field)
break;
}
}
}
/* Skip to the end of the declaration; there's no point in
trying to process it. */
cp_parser_skip_to_end_of_statement (parser);
return true;
}
return false;
}
/* Consume tokens up to, and including, the next non-nested closing `)'.
Returns TRUE iff we found a closing `)'. */
......@@ -2744,15 +2823,21 @@ cp_parser_primary_expression (cp_parser *parser,
}
}
/* If unqualified name lookup fails while processing a
template, that just means that we need to do name
lookup again when the template is instantiated. */
if (!parser->scope
&& decl == error_mark_node
&& processing_template_decl)
{
/* Unqualified name lookup failed while processing a
template. */
*idk = CP_PARSER_ID_KIND_UNQUALIFIED;
return build_min_nt (LOOKUP_EXPR, id_expression);
/* If the next token is a parenthesis, assume that
Koenig lookup will succeed when instantiating the
template. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
return build_min_nt (LOOKUP_EXPR, id_expression);
/* If we're not doing Koenig lookup, issue an error. */
error ("`%D' has not been declared", id_expression);
return error_mark_node;
}
else if (decl == error_mark_node
&& !processing_template_decl)
......@@ -3521,7 +3606,12 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
: new_scope);
/* If it is a class scope, try to complete it; we are about to
be looking up names inside the class. */
if (TYPE_P (parser->scope))
if (TYPE_P (parser->scope)
/* Since checking types for dependency can be expensive,
avoid doing it if the type is already complete. */
&& !COMPLETE_TYPE_P (parser->scope)
/* Do not try to complete dependent types. */
&& !cp_parser_dependent_type_p (parser->scope))
complete_type (parser->scope);
}
......@@ -6656,6 +6746,21 @@ cp_parser_simple_declaration (parser, function_definition_allowed_p)
/* We no longer need to defer access checks. */
stop_deferring_access_checks ();
/* If the next two tokens are both identifiers, the code is
erroneous. The usual cause of this situation is code like:
T t;
where "T" should name a type -- but does not. */
if (cp_parser_diagnose_invalid_type_name (parser))
{
/* If parsing tenatively, we should commit; we really are
looking at a declaration. */
cp_parser_commit_to_tentative_parse (parser);
/* Give up. */
return;
}
/* Keep going until we hit the `;' at the end of the simple
declaration. */
saw_declarator = false;
......@@ -12061,6 +12166,9 @@ cp_parser_member_declaration (parser)
CP_PARSER_FLAGS_OPTIONAL,
&prefix_attributes,
&declares_class_or_enum);
/* Check for an invalid type-name. */
if (cp_parser_diagnose_invalid_type_name (parser))
return;
/* If there is no declarator, then the decl-specifier-seq should
specify a type. */
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
......@@ -13818,7 +13926,11 @@ cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p)
cp_token *next_token;
/* The common case is that this is not a constructor declarator, so
try to avoid doing lots of work if at all possible. */
try to avoid doing lots of work if at all possible. It's not
valid declare a constructor at function scope. */
if (at_function_scope_p ())
return false;
/* And only certain tokens can begin a constructor declarator. */
next_token = cp_lexer_peek_token (parser->lexer);
if (next_token->type != CPP_NAME
&& next_token->type != CPP_SCOPE
......@@ -13853,7 +13965,7 @@ cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p)
{
/* If we have:
template <typename T> struct S { S(); }
template <typename T> struct S { S(); };
template <typename T> S<T>::S ();
we must recognize that the nested `S' names a class.
......
......@@ -5152,63 +5152,26 @@ instantiate_class_template (type)
/* Figure out which arguments are being used to do the
instantiation. */
args = CLASSTYPE_TI_ARGS (type);
PARTIAL_INSTANTIATION_P (type) = uses_template_parms (args);
if (pedantic && PARTIAL_INSTANTIATION_P (type))
/* If this is a partial instantiation, then we can't instantiate
the type; there's no telling whether or not one of the
template parameters might eventually be instantiated to some
value that results in a specialization being used. For
example, consider:
template <class T>
struct S {};
template <class U>
void f(S<U>);
template <>
struct S<int> {};
Now, the `S<U>' in `f<int>' is the specialization, not an
instantiation of the original template. */
return type;
/* Determine what specialization of the original template to
instantiate. */
if (PARTIAL_INSTANTIATION_P (type))
/* There's no telling which specialization is appropriate at this
point. Since all peeking at the innards of this partial
instantiation are extensions (like the "implicit typename"
extension, which allows users to omit the keyword `typename' on
names that are declared as types in template base classes), we
are free to do what we please.
Trying to figure out which partial instantiation to use can
cause a crash. (Some of the template arguments don't even have
types.) So, we just use the most general version. */
t = NULL_TREE;
else
t = most_specialized_class (template, args);
if (t == error_mark_node)
{
t = most_specialized_class (template, args);
if (t == error_mark_node)
const char *str = "candidates are:";
error ("ambiguous class template instantiation for `%#T'", type);
for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t;
t = TREE_CHAIN (t))
{
const char *str = "candidates are:";
error ("ambiguous class template instantiation for `%#T'", type);
for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t;
t = TREE_CHAIN (t))
if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
args))
{
if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
args))
{
cp_error_at ("%s %+#T", str, TREE_TYPE (t));
str = " ";
}
cp_error_at ("%s %+#T", str, TREE_TYPE (t));
str = " ";
}
TYPE_BEING_DEFINED (type) = 1;
return error_mark_node;
}
TYPE_BEING_DEFINED (type) = 1;
return error_mark_node;
}
if (t)
......@@ -5221,26 +5184,6 @@ instantiate_class_template (type)
if (!COMPLETE_TYPE_P (pattern))
return type;
/* If this is a partial instantiation, don't tsubst anything. We will
only use this type for implicit typename, so the actual contents don't
matter. All that matters is whether a particular name is a type. */
if (PARTIAL_INSTANTIATION_P (type))
{
/* The fields set here must be kept in sync with those cleared
in begin_class_definition. */
TYPE_BINFO_BASETYPES (type) = TYPE_BINFO_BASETYPES (pattern);
TYPE_FIELDS (type) = TYPE_FIELDS (pattern);
TYPE_METHODS (type) = TYPE_METHODS (pattern);
CLASSTYPE_DECL_LIST (type) = CLASSTYPE_DECL_LIST (pattern);
CLASSTYPE_TAGS (type) = CLASSTYPE_TAGS (pattern);
CLASSTYPE_VBASECLASSES (type) = CLASSTYPE_VBASECLASSES (pattern);
/* Pretend that the type is complete, so that we will look
inside it during name lookup and such. */
TYPE_SIZE (type) = bitsize_zero_node;
return type;
}
/* If we've recursively instantiated too many templates, stop. */
if (! push_tinst_level (type))
return type;
......
......@@ -1350,7 +1350,7 @@ lookup_field_r (binfo, data)
}
else
{
if (from_dep_base_p && TREE_CODE (nval) != TYPE_DECL
if (from_dep_base_p && TREE_CODE (nval) == TYPE_DECL
/* We need to return a member template class so we can
define partial specializations. Is there a better
way? */
......@@ -1500,9 +1500,7 @@ lookup_member (xbasetype, name, protect, want_type)
/* If the thing we found was found via the implicit typename
extension, build the typename type. */
if (rval && lfi.from_dep_base_p && !DECL_CLASS_TEMPLATE_P (rval))
rval = TYPE_STUB_DECL (build_typename_type (BINFO_TYPE (basetype_path),
name, name,
TREE_TYPE (rval)));
abort ();
if (rval && is_overloaded_fn (rval))
rval = build_baselink (rval_binfo, basetype_path, rval,
......@@ -2187,6 +2185,7 @@ marked_pushdecls_p (binfo, data)
void *data ATTRIBUTE_UNUSED;
{
return (CLASS_TYPE_P (BINFO_TYPE (binfo))
&& !dependent_base_p (binfo)
&& BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
}
......@@ -2196,6 +2195,7 @@ unmarked_pushdecls_p (binfo, data)
void *data ATTRIBUTE_UNUSED;
{
return (CLASS_TYPE_P (BINFO_TYPE (binfo))
&& !dependent_base_p (binfo)
&& !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
}
......
......@@ -1797,11 +1797,6 @@ begin_class_definition (t)
error ("definition of `%#T' inside template parameter list", t);
return error_mark_node;
}
/* In a definition of a member class template, we will get here with
an implicit typename. */
if (IMPLICIT_TYPENAME_P (t))
t = TREE_TYPE (t);
/* A non-implicit typename comes from code like:
template <typename T> struct A {
......@@ -1820,56 +1815,9 @@ begin_class_definition (t)
pushtag (make_anon_name (), t, 0);
}
/* If we generated a partial instantiation of this type, but now
we're seeing a real definition, we're actually looking at a
partial specialization. Consider:
template <class T, class U>
struct Y {};
template <class T>
struct X {};
template <class T, class U>
void f()
{
typename X<Y<T, U> >::A a;
}
template <class T, class U>
struct X<Y<T, U> >
{
};
We have to undo the effects of the previous partial
instantiation. */
if (PARTIAL_INSTANTIATION_P (t))
{
if (!pedantic)
{
/* Unfortunately, when we're not in pedantic mode, we
attempt to actually fill in some of the fields of the
partial instantiation, in order to support the implicit
typename extension. Clear those fields now, in
preparation for the definition here. The fields cleared
here must match those set in instantiate_class_template.
Look for a comment mentioning begin_class_definition
there. */
TYPE_BINFO_BASETYPES (t) = NULL_TREE;
TYPE_FIELDS (t) = NULL_TREE;
TYPE_METHODS (t) = NULL_TREE;
CLASSTYPE_DECL_LIST (t) = NULL_TREE;
CLASSTYPE_TAGS (t) = NULL_TREE;
CLASSTYPE_VBASECLASSES (t) = NULL_TREE;
TYPE_SIZE (t) = NULL_TREE;
}
/* This isn't a partial instantiation any more. */
PARTIAL_INSTANTIATION_P (t) = 0;
}
/* If this type was already complete, and we see another definition,
that's an error. */
else if (COMPLETE_TYPE_P (t))
if (COMPLETE_TYPE_P (t))
duplicate_tag_error (t);
/* Update the location of the decl. */
......
2003-01-16 Mark Mitchell <mark@codesourcery.com>
* gcc/testsuite/g++.dg/ext/typename1.C: Add typename keyword.
* gcc/testsuite/g++.dg/template/crash1.C: Update error messages.
* gcc/testsuite/g++.dg/template/crash2.C: Remove error message.
* gcc/testsuite/g++.dg/parse/typename2.C: New test.
* gcc/testsuite/g++.dg/template/typename2.C: Change implicit
typename warning into error.
* gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C: Issue more
error messages.
* gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C: Fix typos.
* gcc/testsuite/g++.old-deja/g++.brendan/crash56.C: Add this->.
* gcc/testsuite/g++.old-deja/g++.law/visibility13.C: Remove error
messages.
* gcc/testsuite/g++.old-deja/g++.ns/template17.C: Reorder code to
make declaration visible in template.
* gcc/testsuite/g++.old-deja/g++.pt/crash3.C: Fix typos.
* gcc/testsuite/g++.old-deja/g++.pt/crash36.C: Issue more error
messages.
* gcc/testsuite/g++.old-deja/g++.pt/crash5.C: Improve error
message.
* gcc/testsuite/g++.old-deja/g++.pt/crash67.C: Remove warning.
* gcc/testsuite/g++.old-deja/g++.pt/inherit1.C: Add this->.
* gcc/testsuite/g++.old-deja/g++.pt/niklas01a.C: Add error message.
* gcc/testsuite/g++.old-deja/g++.pt/typename16.C: Replace implicit
typename warning with error message.
* gcc/testsuite/g++.old-deja/g++.pt/typename19.C: Remove warning.
* gcc/testsuite/g++.old-deja/g++.robertl/eb112.C: Fix typo.
* gcc/testsuite/g++.old-deja/g++.robertl/eb24.C: Use this->.
2003-01-16 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/parse/ambig2.C: New test.
......
......@@ -3,5 +3,5 @@
template <class T> struct A { typedef int X; };
template <class T> struct B { typedef A<T> Y; void f (typename Y::X); };
template <class T, class T1, class T2, class T3> struct C : public B<T> { void g (typename Y::X); };
template <class T, class T1, class T2, class T3> struct C : public B<T> { void g (typename B<T>::Y::X); };
template class B<int>;
template<class T, class U>
struct UnaryReturn {
typedef T Type_t;
};
struct foo
{
template <class T>
typename UnaryReturn<T, int>::Type_t
bar();
};
template<class T>
struct UnaryReturn<T, int> {
typedef bool Type_t;
};
// { dg-do compile }
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2001 <nathan@codesourcery.com>
// PR 5125. ICE
......@@ -12,6 +12,6 @@ class S
};
template <class I>
void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo" }
void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo|f|TYPO|o" }
{ // { dg-error "expected `;'" }
}
......@@ -17,7 +17,7 @@ enum E { max = 5 };
struct B
{
A<E> a; // { dg-error "" }
A<E> a;
};
}
......
// { dg-do compile }
// { dg-options "" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Mar 2002 <nathan@codesourcery.com>
// PR 5507. Overzealous implicit typename warning
......@@ -21,5 +21,5 @@ class ctype : public __ctype_abstract_base<_CharT>
template<typename _CharT>
class ctype2 : public __ctype_abstract_base<_CharT>
{
typedef mask mask; // { dg-warning "(implicitly a typename)|(implicit typename)" "" }
typedef mask mask; // { dg-error "" }
};
......@@ -127,7 +127,7 @@ public:
friend bool foo(T161 u)
{
Xseven<T161, 5, int> obj; // ERROR - .*
return (obj.inst == u.inst);
return (obj.inst == u.inst); // ERROR - .*
}
};
......@@ -192,10 +192,10 @@ template <long l>// ERROR - .*
struct Xthirteen {
template <long l> long comp_ge(long test) {// ERROR - .
long local_value;
if (local_value > value)
if (local_value > value) // ERROR - .*
return local_value;
else
return value;
return value; // ERROR - .*
}
};
......
......@@ -115,7 +115,7 @@ protected:
template <class T17, int i> struct Xtwenty {
void f(){
T17 my_type; //ok
for (int j = 0; j < 5; ++l)
for (int j = 0; j < 5; ++j)
{
T17 my_type; //ok
++my_type;
......
......@@ -51,7 +51,7 @@ unsigned short X_one<T>::ret_id() {
export template <class T2> // WARNING -
bool compare_ge(T2 test) {
if (test > type)
if (test > type) // ERROR - .*
return true;
return false;
}
......
......@@ -273,10 +273,10 @@ template<class T>
void
SetLD<T>::remove(const T& item)
{
typename ListD<T>::Action a = NORMAL;
typename ListD<T>::Action a = this->NORMAL;
Vix x;
for (first(x); 0 != x && REMOVE_CURRENT != a; next(x, a))
a = operator()(x) == item ? REMOVE_CURRENT: NORMAL;// ERROR - .*
for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // ERROR - .*
}
template<class T>
bool
......
......@@ -25,8 +25,8 @@ public:
virtual Type& operator[](int ix) { return ia[ix]; }
private:
void init(const Type*, int);
int size; // ERROR - private
int *ia; // ERROR - private
int size;
int *ia;
};
template <class Type>
......
// Build don't link:
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Apr 2001 <nathan@codesourcery.com>
// Bug 2258. We failed to implement using directives inside template
......@@ -16,6 +16,11 @@ namespace whatever
template <typename T> void fn (T, T (*)(T));
namespace whatever
{
template <typename T> T end3 (T);
}
template <class T> void mycout(const T& data)
{
using namespace thing;
......@@ -25,11 +30,6 @@ template <class T> void mycout(const T& data)
fn (data, end3);
}
namespace whatever
{
template <typename T> T end3 (T);
}
int main()
{
double data = 5.0;
......
......@@ -5,12 +5,12 @@ class CVector {
public:
CVector<int> f() const
{
CVector<int> v(n);
CVector<int> v();
return v;
}
CVector<long> g() const
{
CVector<long> v(n);
CVector<long> v();
return v;
}
};
......@@ -29,7 +29,7 @@ struct list {
reverse_iterator<list_iterator<T> > rbegin()
{ return reverse_iterator<list_iterator<T> > // ERROR - no type|instantiated here
(list_iterator<T>(Head->next())); }
(list_iterator<T>(Head->next())); } // ERROR - not declared
};
template class list<int>;
// Build don't link:
template <class T, int i>
struct K { // ERROR - forward declaration
struct K {
void f();
};
template <class T>
void
K<T, i>::f()
{ // ERROR - template parameters
K<T, i>::f() // ERROR - i has not been declared
{
}
// Build don't link:
// Special g++ Options:
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 May 2001 <nathan@codesourcery.com>
// Bug 2526. We ICE'd after diagnosing dependent name confusion in
......@@ -16,5 +16,5 @@ struct B
template<typename T>
struct D : B<T>
{
friend class Mother; // WARNING - defines namespace class
friend class Mother;
};
......@@ -14,7 +14,7 @@ template <int dim>
class FinalClass : public Derived<dim> {
public:
FinalClass () {
if (&local1 != &local2)
if (&this->local1 != &this->local2)
i = 0;
}
};
......
// Build don't link:
struct A {
struct A { // ERROR - forward declaration
friend struct B : A { // ERROR -
int x;
};
......
......@@ -11,7 +11,7 @@ struct D1 : public B {
template <class T>
struct D2 : public D1<T> {
I i; // WARNING - implicit typename
I i; // ERROR - not a type
};
template <>
......@@ -27,5 +27,5 @@ void f(double) {}
int main()
{
D2<int> d2i;
f(d2i.i);
f(d2i.i); // ERROR - no member i
}
......@@ -12,7 +12,7 @@ struct S {
template <class U>
struct I : public O<U> {
static X x; // WARNING - lookup finds S<T>::X
static X x;
};
};
......
......@@ -4,8 +4,7 @@ setback(MEMBER *bp, MEMBER STRUCT::*offset)
{
// The implementation of this function may be platform dependend
if(!bp) return 0; // NULL pointers remain NULL
union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't
+work.
union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't work.
u.of = offset;
return (STRUCT *) ((int) bp - u.i);
}
......
......@@ -19,5 +19,5 @@ class Y : public X<T>
using X<T>::x;
void f () { std::cout << x << std::endl; }
void f () { std::cout << this->x << std::endl; }
};
2003-01-16 Mark Mitchell <mark@codesourcery.com>
Jeffrey Oldham <oldham@codesourcery.com>
* config/locale/gnu/messages_members.h: Use this-> to refer to
unqualified members of base clasess.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Likewise.
* include/bits/codecvt.h: Likewise.
* include/bits/deque.tcc: Likewise.
* include/bits/fstream.tcc: Likewise.
* include/bits/istream.tcc: Likewise.
* include/bits/list.tcc: Likewise.
* include/bits/locale_facets.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/sstream.tcc: Likewise.
* include/bits/stl_bvector.h: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_tree.h: Likewise.
* include/bits/stl_vector.h: Likewise.
* include/bits/vector.tcc: Likewise.
* include/ext/ropeimpl.h: Likewise.
* include/ext/stdio_filebuf.h: Likewise.
* include/ext/stl_rope.h: Likewise.
* include/std/std_fstream.h: Likewise.
* include/std/std_sstream.h: Likewise.
2003-01-15 Phil Edwards <pme@gcc.gnu.org>
* include/bits/basic_string.tcc (_S_string_copy): Unused, remove.
......
......@@ -99,11 +99,11 @@
: messages<_CharT>(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (_S_c_name != _M_name_messages)
delete [] _M_name_messages;
_M_name_messages = new char[strlen(__s) + 1];
strcpy(_M_name_messages, __s);
if (this->_S_c_name != this->_M_name_messages)
delete [] this->_M_name_messages;
this->_M_name_messages = new char[strlen(__s) + 1];
strcpy(this->_M_name_messages, __s);
#endif
_S_destroy_c_locale(_M_c_locale_messages);
_S_create_c_locale(_M_c_locale_messages, __s);
_S_destroy_c_locale(this->_M_c_locale_messages);
_S_create_c_locale(this->_M_c_locale_messages, __s);
}
// Locale support (codecvt) -*- C++ -*-
// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2000, 2001, 2002, 2003 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
......@@ -260,7 +260,7 @@
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
result __ret = error;
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
......@@ -304,7 +304,7 @@
{
__from_next = reinterpret_cast<const intern_type*>(__cfrom);
__to_next = reinterpret_cast<extern_type*>(__cto);
__ret = ok;
__ret = codecvt_base::ok;
}
else
{
......@@ -312,10 +312,10 @@
{
__from_next = reinterpret_cast<const intern_type*>(__cfrom);
__to_next = reinterpret_cast<extern_type*>(__cto);
__ret = partial;
__ret = codecvt_base::partial;
}
else
__ret = error;
__ret = codecvt_base::error;
}
}
return __ret;
......@@ -327,7 +327,7 @@
do_unshift(state_type& __state, extern_type* __to,
extern_type* __to_end, extern_type*& __to_next) const
{
result __ret = error;
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
......@@ -345,14 +345,14 @@
{
__to_next = reinterpret_cast<extern_type*>(__cto);
if (__tlen == __tmultiple * (__to_end - __to))
__ret = noconv;
__ret = codecvt_base::noconv;
else if (__tlen == 0)
__ret = ok;
__ret = codecvt_base::ok;
else
__ret = partial;
__ret = codecvt_base::partial;
}
else
__ret = error;
__ret = codecvt_base::error;
}
return __ret;
}
......@@ -365,7 +365,7 @@
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
result __ret = error;
result __ret = codecvt_base::error;
if (__state._M_good())
{
typedef state_type::__desc_type __desc_type;
......@@ -410,7 +410,7 @@
{
__from_next = reinterpret_cast<const extern_type*>(__cfrom);
__to_next = reinterpret_cast<intern_type*>(__cto);
__ret = ok;
__ret = codecvt_base::ok;
}
else
{
......@@ -418,10 +418,10 @@
{
__from_next = reinterpret_cast<const extern_type*>(__cfrom);
__to_next = reinterpret_cast<intern_type*>(__cto);
__ret = partial;
__ret = codecvt_base::partial;
}
else
__ret = error;
__ret = codecvt_base::error;
}
}
return __ret;
......
// Locale support (codecvt) -*- C++ -*-
// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2000, 2001, 2002, 2003 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
......@@ -341,9 +341,9 @@
codecvt_byname(const char* __s, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__refs)
{
if (_M_c_locale_codecvt != _S_c_locale)
_S_destroy_c_locale(_M_c_locale_codecvt);
_S_create_c_locale(_M_c_locale_codecvt, __s);
if (this->_M_c_locale_codecvt != this->_S_c_locale)
_S_destroy_c_locale(this->_M_c_locale_codecvt);
_S_create_c_locale(this->_M_c_locale_codecvt, __s);
}
protected:
......
// File based streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -44,12 +44,12 @@ namespace std
basic_filebuf<_CharT, _Traits>::
_M_allocate_internal_buffer()
{
if (!_M_buf && _M_buf_size_opt)
if (!this->_M_buf && this->_M_buf_size_opt)
{
_M_buf_size = _M_buf_size_opt;
this->_M_buf_size = this->_M_buf_size_opt;
// Allocate internal buffer.
_M_buf = new char_type[_M_buf_size];
this->_M_buf = new char_type[this->_M_buf_size];
_M_buf_allocated = true;
}
}
......@@ -62,8 +62,8 @@ namespace std
{
if (_M_buf_allocated)
{
delete [] _M_buf;
_M_buf = NULL;
delete [] this->_M_buf;
this->_M_buf = NULL;
_M_buf_allocated = false;
this->setg(NULL, NULL, NULL);
this->setp(NULL, NULL);
......@@ -75,7 +75,7 @@ namespace std
basic_filebuf() : __streambuf_type(), _M_file(&_M_lock),
_M_state_cur(__state_type()), _M_state_beg(__state_type()),
_M_buf_allocated(false), _M_last_overflowed(false)
{ _M_buf_unified = true; }
{ this->_M_buf_unified = true; }
template<typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
......@@ -89,7 +89,7 @@ namespace std
if (this->is_open())
{
_M_allocate_internal_buffer();
_M_mode = __mode;
this->_M_mode = __mode;
// Setup initial position of buffer.
_M_set_indeterminate();
......@@ -120,13 +120,14 @@ namespace std
if (this->is_open())
{
const int_type __eof = traits_type::eof();
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
bool __testput = this->_M_out_cur
&& this->_M_out_beg < this->_M_out_end;
if (__testput
&& traits_type::eq_int_type(_M_really_overflow(__eof), __eof))
return __ret;
// NB: Do this here so that re-opened filebufs will be cool...
_M_mode = ios_base::openmode(0);
this->_M_mode = ios_base::openmode(0);
_M_destroy_internal_buffer();
_M_pback_destroy();
......@@ -153,10 +154,10 @@ namespace std
showmanyc()
{
streamsize __ret = -1;
bool __testin = _M_mode & ios_base::in;
bool __testin = this->_M_mode & ios_base::in;
if (__testin && this->is_open())
__ret = _M_in_end - _M_in_cur;
__ret = this->_M_in_end - this->_M_in_cur;
_M_last_overflowed = false;
return __ret;
}
......@@ -167,42 +168,42 @@ namespace std
pbackfail(int_type __i)
{
int_type __ret = traits_type::eof();
bool __testin = _M_mode & ios_base::in;
bool __testin = this->_M_mode & ios_base::in;
if (__testin)
{
bool __testpb = _M_in_beg < _M_in_cur;
bool __testpb = this->_M_in_beg < this->_M_in_cur;
char_type __c = traits_type::to_char_type(__i);
bool __testeof = traits_type::eq_int_type(__i, __ret);
if (__testpb)
{
bool __testout = _M_mode & ios_base::out;
bool __testout = this->_M_mode & ios_base::out;
bool __testeq = traits_type::eq(__c, this->gptr()[-1]);
// Try to put back __c into input sequence in one of three ways.
// Order these tests done in is unspecified by the standard.
if (!__testeof && __testeq)
{
--_M_in_cur;
--this->_M_in_cur;
if (__testout)
--_M_out_cur;
--this->_M_out_cur;
__ret = __i;
}
else if (__testeof)
{
--_M_in_cur;
--this->_M_in_cur;
if (__testout)
--_M_out_cur;
--this->_M_out_cur;
__ret = traits_type::not_eof(__i);
}
else if (!__testeof)
{
--_M_in_cur;
--this->_M_in_cur;
if (__testout)
--_M_out_cur;
--this->_M_out_cur;
_M_pback_create();
*_M_in_cur = __c;
*this->_M_in_cur = __c;
__ret = __i;
}
}
......@@ -214,10 +215,10 @@ namespace std
this->underflow();
if (!__testeof)
{
if (!traits_type::eq(__c, *_M_in_cur))
if (!traits_type::eq(__c, *this->_M_in_cur))
{
_M_pback_create();
*_M_in_cur = __c;
*this->_M_in_cur = __c;
}
__ret = __i;
}
......@@ -235,14 +236,15 @@ namespace std
overflow(int_type __c)
{
int_type __ret = traits_type::eof();
bool __testput = _M_out_cur && _M_out_cur < _M_buf + _M_buf_size;
bool __testout = _M_mode & ios_base::out;
bool __testput = this->_M_out_cur
&& this->_M_out_cur < this->_M_buf + this->_M_buf_size;
bool __testout = this->_M_mode & ios_base::out;
if (__testout)
{
if (__testput)
{
*_M_out_cur = traits_type::to_char_type(__c);
*this->_M_out_cur = traits_type::to_char_type(__c);
_M_out_cur_move(1);
__ret = traits_type::not_eof(__c);
}
......@@ -297,7 +299,7 @@ namespace std
if (__r == codecvt_base::partial)
{
const char_type* __iresume = __iend;
streamsize __rlen = _M_out_end - __iend;
streamsize __rlen = this->_M_out_end - __iend;
__r = __cvt.out(_M_state_cur, __iresume, __iresume + __rlen,
__iend, __buf, __buf + __blen, __bend);
if (__r != codecvt_base::error)
......@@ -319,8 +321,8 @@ namespace std
_M_really_overflow(int_type __c)
{
int_type __ret = traits_type::eof();
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
bool __testunbuffered = _M_file.is_open() && !_M_buf_size_opt;
bool __testput = this->_M_out_cur && this->_M_out_beg < this->_M_out_end;
bool __testunbuffered = _M_file.is_open() && !this->_M_buf_size_opt;
if (__testput || __testunbuffered)
{
......@@ -331,16 +333,17 @@ namespace std
// Need to restore current position. The position of the external
// byte sequence (_M_file) corresponds to _M_filepos, and we need
// to move it to _M_out_beg for the write.
if (_M_filepos && _M_filepos != _M_out_beg)
if (_M_filepos && _M_filepos != this->_M_out_beg)
{
off_type __off = _M_out_beg - _M_filepos;
off_type __off = this->_M_out_beg - _M_filepos;
_M_file.seekoff(__off, ios_base::cur);
}
// Convert internal buffer to external representation, output.
// NB: In the unbuffered case, no internal buffer exists.
if (!__testunbuffered)
_M_convert_to_external(_M_out_beg, _M_out_end - _M_out_beg,
_M_convert_to_external(this->_M_out_beg,
this->_M_out_end - this->_M_out_beg,
__elen, __plen);
// Convert pending sequence to external representation, output.
......@@ -373,7 +376,7 @@ namespace std
setbuf(char_type* __s, streamsize __n)
{
if (!this->is_open() && __s == 0 && __n == 0)
_M_buf_size_opt = 0;
this->_M_buf_size_opt = 0;
else if (__s && __n)
{
// This is implementation-defined behavior, and assumes
......@@ -384,8 +387,8 @@ namespace std
_M_destroy_internal_buffer();
// Step 2: Use the external array.
_M_buf = __s;
_M_buf_size_opt = _M_buf_size = __n;
this->_M_buf = __s;
this->_M_buf_size_opt = this->_M_buf_size = __n;
_M_set_indeterminate();
}
_M_last_overflowed = false;
......@@ -398,11 +401,11 @@ namespace std
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __ret = pos_type(off_type(-1));
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
// Should probably do has_facet checks here.
int __width = use_facet<__codecvt_type>(_M_buf_locale).encoding();
int __width = use_facet<__codecvt_type>(this->_M_buf_locale).encoding();
if (__width < 0)
__width = 0;
bool __testfail = __off != 0 && __width <= 0;
......@@ -416,8 +419,10 @@ namespace std
{
off_type __computed_off = __width * __off;
bool __testget = _M_in_cur && _M_in_beg < _M_in_end;
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
bool __testget = this->_M_in_cur
&& this->_M_in_beg < this->_M_in_end;
bool __testput = this->_M_out_cur
&& this->_M_out_beg < this->_M_out_end;
// Sync the internal and external streams.
// out
if (__testput || _M_last_overflowed)
......@@ -429,7 +434,7 @@ namespace std
}
//in
else if (__testget && __way == ios_base::cur)
__computed_off += _M_in_cur - _M_filepos;
__computed_off += this->_M_in_cur - _M_filepos;
__ret = _M_file.seekoff(__computed_off, __way, __mode);
_M_set_indeterminate();
......@@ -439,7 +444,8 @@ namespace std
else
{
__ret = _M_file.seekoff(__off, ios_base::cur, __mode);
__ret += std::max(_M_out_cur, _M_in_cur) - _M_filepos;
__ret +=
std::max(this->_M_out_cur, this->_M_in_cur) - _M_filepos;
}
}
_M_last_overflowed = false;
......@@ -470,10 +476,10 @@ namespace std
{
bool __testbeg = gptr() == eback() && pptr() == pbase();
if (__testbeg && _M_buf_locale != __loc)
if (__testbeg && this->_M_buf_locale != __loc)
{
_M_buf_locale = __loc;
_M_buf_locale_init = true;
this->_M_buf_locale = __loc;
this->_M_buf_locale_init = true;
}
// NB this may require the reconversion of previously
......
......@@ -114,8 +114,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -142,8 +142,8 @@ namespace std
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
long __l;
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __l);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __l);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
if (!(__err & ios_base::failbit)
......@@ -178,8 +178,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -206,8 +206,8 @@ namespace std
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
long __l;
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __l);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __l);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
if (!(__err & ios_base::failbit)
......@@ -242,8 +242,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -269,8 +269,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -296,8 +296,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -324,8 +324,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -351,8 +351,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -379,8 +379,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -406,8 +406,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -433,8 +433,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......@@ -460,8 +460,8 @@ namespace std
try
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (_M_check_facet(_M_fnumget))
_M_fnumget->get(*this, 0, *this, __err, __n);
if (_M_check_facet(this->_M_fnumget))
this->_M_fnumget->get(*this, 0, *this, __err, __n);
this->setstate(__err);
}
catch(exception& __fail)
......
// List implementation (out of line) -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
......@@ -69,16 +69,16 @@ namespace std
__clear()
{
typedef _List_node<_Tp> _Node;
_Node* __cur = static_cast<_Node*>(_M_node->_M_next);
while (__cur != _M_node)
_Node* __cur = static_cast<_Node*>(this->_M_node->_M_next);
while (__cur != this->_M_node)
{
_Node* __tmp = __cur;
__cur = static_cast<_Node*>(__cur->_M_next);
_Destroy(&__tmp->_M_data);
_M_put_node(__tmp);
}
_M_node->_M_next = _M_node;
_M_node->_M_prev = _M_node;
this->_M_node->_M_next = this->_M_node;
this->_M_node->_M_prev = this->_M_node;
}
template<typename _Tp, typename _Alloc>
......@@ -250,7 +250,8 @@ namespace std
sort()
{
// Do nothing if the list has length 0 or 1.
if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node)
if (this->_M_node->_M_next != this->_M_node
&& this->_M_node->_M_next->_M_next != this->_M_node)
{
list __carry;
list __counter[64];
......@@ -340,7 +341,8 @@ namespace std
sort(_StrictWeakOrdering __comp)
{
// Do nothing if the list has length 0 or 1.
if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node)
if (this->_M_node->_M_next != this->_M_node &&
this->_M_node->_M_next->_M_next != this->_M_node)
{
list __carry;
list __counter[64];
......
......@@ -921,8 +921,8 @@ namespace std
collate_byname(const char* __s, size_t __refs = 0)
: collate<_CharT>(__refs)
{
_S_destroy_c_locale(_M_c_locale_collate);
_S_create_c_locale(_M_c_locale_collate, __s);
_S_destroy_c_locale(this->_M_c_locale_collate);
_S_create_c_locale(this->_M_c_locale_collate, __s);
}
protected:
......
......@@ -149,8 +149,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......@@ -176,16 +177,18 @@ namespace std
{
char_type __c = this->fill();
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (_M_check_facet(_M_fnumput))
if (_M_check_facet(this->_M_fnumput))
{
bool __b = false;
if ((__fmt & ios_base::oct) || (__fmt & ios_base::hex))
{
unsigned long __l = static_cast<unsigned long>(__n);
__b = _M_fnumput->put(*this, *this, __c, __l).failed();
__b = this->_M_fnumput->put(*this, *this,
__c, __l).failed();
}
else
__b = _M_fnumput->put(*this, *this, __c, __n).failed();
__b = this->_M_fnumput->put(*this, *this,
__c, __n).failed();
if (__b)
this->setstate(ios_base::badbit);
}
......@@ -211,8 +214,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......@@ -239,17 +243,19 @@ namespace std
{
char_type __c = this->fill();
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (_M_check_facet(_M_fnumput))
if (_M_check_facet(this->_M_fnumput))
{
bool __b = false;
if ((__fmt & ios_base::oct) || (__fmt & ios_base::hex))
{
unsigned long long __l;
__l = static_cast<unsigned long long>(__n);
__b = _M_fnumput->put(*this, *this, __c, __l).failed();
__b = this->_M_fnumput->put(*this, *this,
__c, __l).failed();
}
else
__b = _M_fnumput->put(*this, *this, __c, __n).failed();
__b = this->_M_fnumput->put(*this, *this,
__c, __n).failed();
if (__b)
this->setstate(ios_base::badbit);
}
......@@ -275,8 +281,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......@@ -301,8 +308,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......@@ -326,8 +334,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......@@ -351,8 +360,9 @@ namespace std
{
try
{
if (_M_check_facet(_M_fnumput))
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
if (_M_check_facet(this->_M_fnumput))
if (this->_M_fnumput->put(*this, *this,
this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail)
......
......@@ -48,7 +48,7 @@ namespace std
{
int_type __ret = traits_type::eof();
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
bool __testpos = _M_in_cur && _M_in_beg < _M_in_cur;
bool __testpos = this->_M_in_cur && this->_M_in_beg < this->_M_in_cur;
// Try to put back __c into input sequence in one of three ways.
// Order these tests done in is unspecified by the standard.
......@@ -57,18 +57,18 @@ namespace std
if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])
&& !__testeof)
{
--_M_in_cur;
--this->_M_in_cur;
__ret = __c;
}
else if (!__testeof)
{
--_M_in_cur;
*_M_in_cur = traits_type::to_char_type(__c);
--this->_M_in_cur;
*this->_M_in_cur = traits_type::to_char_type(__c);
__ret = __c;
}
else if (__testeof)
{
--_M_in_cur;
--this->_M_in_cur;
__ret = traits_type::not_eof(__c);
}
}
......@@ -82,8 +82,8 @@ namespace std
{
int_type __ret = traits_type::eof();
bool __testeof = traits_type::eq_int_type(__c, __ret);
bool __testwrite = _M_out_cur < _M_buf + _M_buf_size;
bool __testout = _M_mode & ios_base::out;
bool __testwrite = this->_M_out_cur < this->_M_buf + this->_M_buf_size;
bool __testout = this->_M_mode & ios_base::out;
// Try to append __c into output sequence in one of two ways.
// Order these tests done in is unspecified by the standard.
......@@ -91,7 +91,8 @@ namespace std
{
if (!__testeof)
{
__size_type __len = std::max(_M_buf_size, _M_buf_size_opt);
__size_type __len = std::max(this->_M_buf_size,
this->_M_buf_size_opt);
__len *= 2;
if (__testwrite)
......@@ -101,10 +102,10 @@ namespace std
// Force-allocate, re-sync.
_M_string = this->str();
_M_string.reserve(__len);
_M_buf_size = __len;
_M_really_sync(_M_in_cur - _M_in_beg,
_M_out_cur - _M_out_beg);
*_M_out_cur = traits_type::to_char_type(__c);
this->_M_buf_size = __len;
_M_really_sync(this->_M_in_cur - this->_M_in_beg,
this->_M_out_cur - this->_M_out_beg);
*this->_M_out_cur = traits_type::to_char_type(__c);
_M_out_cur_move(1);
__ret = __c;
}
......@@ -121,15 +122,15 @@ namespace std
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __ret = pos_type(off_type(-1));
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
bool __testboth = __testin && __testout && __way != ios_base::cur;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
if (_M_buf_size && (__testin || __testout || __testboth))
if (this->_M_buf_size && (__testin || __testout || __testboth))
{
char_type* __beg = _M_buf;
char_type* __beg = this->_M_buf;
char_type* __curi = NULL;
char_type* __curo = NULL;
char_type* __endi = NULL;
......@@ -162,13 +163,13 @@ namespace std
if ((__testin || __testboth)
&& __newoffi + __off >= 0 && __endi - __beg >= __newoffi + __off)
{
_M_in_cur = __beg + __newoffi + __off;
this->_M_in_cur = __beg + __newoffi + __off;
__ret = pos_type(__newoffi);
}
if ((__testout || __testboth)
&& __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
{
_M_out_cur_move(__newoffo + __off - (_M_out_cur - __beg));
_M_out_cur_move(__newoffo + __off - (this->_M_out_cur - __beg));
__ret = pos_type(__newoffo);
}
}
......@@ -182,13 +183,13 @@ namespace std
{
pos_type __ret = pos_type(off_type(-1));
if (_M_buf_size)
if (this->_M_buf_size)
{
off_type __pos = __sp; // Use streamoff operator to do conversion.
char_type* __beg = NULL;
char_type* __end = NULL;
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
bool __testboth = __testin && __testout;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
......@@ -206,16 +207,16 @@ namespace std
if (__testout || __testboth)
{
__beg = this->pbase();
__end = _M_buf + _M_buf_size;
__end = this->_M_buf + this->_M_buf_size;
if (0 <= __pos && __pos <= __end - __beg)
__testposo = true;
}
if (__testposi || __testposo)
{
if (__testposi)
_M_in_cur = _M_in_beg + __pos;
this->_M_in_cur = this->_M_in_beg + __pos;
if (__testposo)
_M_out_cur_move((__pos) - (_M_out_cur - __beg));
_M_out_cur_move((__pos) - (this->_M_out_cur - __beg));
__ret = pos_type(off_type(__pos));
}
}
......
// List implementation -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
......@@ -301,16 +301,16 @@ namespace std
_List_base(const allocator_type& __a)
: _Base(__a)
{
_M_node = _M_get_node();
_M_node->_M_next = _M_node;
_M_node->_M_prev = _M_node;
this->_M_node = _M_get_node();
this->_M_node->_M_next = this->_M_node;
this->_M_node->_M_prev = this->_M_node;
}
// This is what actually destroys the list.
~_List_base()
{
__clear();
_M_put_node(_M_node);
_M_put_node(this->_M_node);
}
void
......@@ -566,28 +566,28 @@ namespace std
* %list. Iteration is done in ordinary element order.
*/
iterator
begin() { return static_cast<_Node*>(_M_node->_M_next); }
begin() { return static_cast<_Node*>(this->_M_node->_M_next); }
/**
* Returns a read-only (constant) iterator that points to the first element
* in the %list. Iteration is done in ordinary element order.
*/
const_iterator
begin() const { return static_cast<_Node*>(_M_node->_M_next); }
begin() const { return static_cast<_Node*>(this->_M_node->_M_next); }
/**
* Returns a read/write iterator that points one past the last element in
* the %list. Iteration is done in ordinary element order.
*/
iterator
end() { return _M_node; }
end() { return this->_M_node; }
/**
* Returns a read-only (constant) iterator that points one past the last
* element in the %list. Iteration is done in ordinary element order.
*/
const_iterator
end() const { return _M_node; }
end() const { return this->_M_node; }
/**
* Returns a read/write reverse iterator that points to the last element in
......@@ -625,7 +625,7 @@ namespace std
* Returns true if the %list is empty. (Thus begin() would equal end().)
*/
bool
empty() const { return _M_node->_M_next == _M_node; }
empty() const { return this->_M_node->_M_next == this->_M_node; }
/** Returns the number of elements in the %list. */
size_type
......@@ -853,7 +853,7 @@ namespace std
* std::swap(l1,l2) will feed to this function.
*/
void
swap(list& __x) { std::swap(_M_node, __x._M_node); }
swap(list& __x) { std::swap(this->_M_node, __x._M_node); }
/**
* Erases all the elements. Note that this function only erases the
......
// RB tree implementation -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
......@@ -576,8 +576,8 @@ namespace std
typedef typename _Base::allocator_type allocator_type;
_Rb_tree_base(const allocator_type& __a)
: _Base(__a) { _M_header = _M_get_node(); }
~_Rb_tree_base() { _M_put_node(_M_header); }
: _Base(__a) { this->_M_header = _M_get_node(); }
~_Rb_tree_base() { _M_put_node(this->_M_header); }
};
......@@ -645,13 +645,13 @@ namespace std
_Compare _M_key_compare;
_Link_type&
_M_root() const { return (_Link_type&) _M_header->_M_parent; }
_M_root() const { return (_Link_type&) this->_M_header->_M_parent; }
_Link_type&
_M_leftmost() const { return (_Link_type&) _M_header->_M_left; }
_M_leftmost() const { return (_Link_type&) this->_M_header->_M_left; }
_Link_type&
_M_rightmost() const { return (_Link_type&) _M_header->_M_right; }
_M_rightmost() const { return (_Link_type&) this->_M_header->_M_right; }
static _Link_type&
_S_left(_Link_type __x) { return (_Link_type&)(__x->_M_left); }
......@@ -737,8 +737,8 @@ namespace std
_M_empty_initialize();
else
{
_S_color(_M_header) = _M_red;
_M_root() = _M_copy(__x._M_root(), _M_header);
_S_color(this->_M_header) = _M_red;
_M_root() = _M_copy(__x._M_root(), this->_M_header);
_M_leftmost() = _S_minimum(_M_root());
_M_rightmost() = _S_maximum(_M_root());
}
......@@ -753,11 +753,11 @@ namespace std
private:
void _M_empty_initialize()
{
_S_color(_M_header) = _M_red; // used to distinguish header from
_S_color(this->_M_header) = _M_red; // used to distinguish header from
// __root, in iterator.operator++
_M_root() = 0;
_M_leftmost() = _M_header;
_M_rightmost() = _M_header;
_M_leftmost() = this->_M_header;
_M_rightmost() = this->_M_header;
}
public:
......@@ -772,10 +772,10 @@ namespace std
begin() const { return _M_leftmost(); }
iterator
end() { return _M_header; }
end() { return this->_M_header; }
const_iterator
end() const { return _M_header; }
end() const { return this->_M_header; }
reverse_iterator
rbegin() { return reverse_iterator(end()); }
......@@ -801,7 +801,7 @@ namespace std
void
swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t)
{
std::swap(_M_header, __t._M_header);
std::swap(this->_M_header, __t._M_header);
std::swap(_M_node_count, __t._M_node_count);
std::swap(_M_key_compare, __t._M_key_compare);
}
......@@ -845,9 +845,9 @@ namespace std
if (_M_node_count != 0)
{
_M_erase(_M_root());
_M_leftmost() = _M_header;
_M_leftmost() = this->_M_header;
_M_root() = 0;
_M_rightmost() = _M_header;
_M_rightmost() = this->_M_header;
_M_node_count = 0;
}
}
......@@ -955,12 +955,12 @@ namespace std
if (__x._M_root() == 0)
{
_M_root() = 0;
_M_leftmost() = _M_header;
_M_rightmost() = _M_header;
_M_leftmost() = this->_M_header;
_M_rightmost() = this->_M_header;
}
else
{
_M_root() = _M_copy(__x._M_root(), _M_header);
_M_root() = _M_copy(__x._M_root(), this->_M_header);
_M_leftmost() = _S_minimum(_M_root());
_M_rightmost() = _S_maximum(_M_root());
_M_node_count = __x._M_node_count;
......@@ -979,13 +979,13 @@ namespace std
_Link_type __y = (_Link_type) __y_;
_Link_type __z;
if (__y == _M_header || __x != 0 ||
if (__y == this->_M_header || __x != 0 ||
_M_key_compare(_KeyOfValue()(__v), _S_key(__y)))
{
__z = _M_create_node(__v);
_S_left(__y) = __z; // also makes _M_leftmost() = __z
// when __y == _M_header
if (__y == _M_header)
if (__y == this->_M_header)
{
_M_root() = __z;
_M_rightmost() = __z;
......@@ -1004,7 +1004,7 @@ namespace std
_S_parent(__z) = __y;
_S_left(__z) = 0;
_S_right(__z) = 0;
_Rb_tree_rebalance(__z, _M_header->_M_parent);
_Rb_tree_rebalance(__z, this->_M_header->_M_parent);
++_M_node_count;
return iterator(__z);
}
......@@ -1015,7 +1015,7 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
insert_equal(const _Val& __v)
{
_Link_type __y = _M_header;
_Link_type __y = this->_M_header;
_Link_type __x = _M_root();
while (__x != 0)
{
......@@ -1033,7 +1033,7 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
insert_unique(const _Val& __v)
{
_Link_type __y = _M_header;
_Link_type __y = this->_M_header;
_Link_type __x = _M_root();
bool __comp = true;
while (__x != 0)
......@@ -1060,7 +1060,7 @@ namespace std
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_unique(iterator __position, const _Val& __v)
{
if (__position._M_node == _M_header->_M_left)
if (__position._M_node == this->_M_header->_M_left)
{
// begin()
if (size() > 0 &&
......@@ -1070,7 +1070,7 @@ namespace std
else
return insert_unique(__v).first;
}
else if (__position._M_node == _M_header)
else if (__position._M_node == this->_M_header)
{
// end()
if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__v)))
......@@ -1102,7 +1102,7 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
insert_equal(iterator __position, const _Val& __v)
{
if (__position._M_node == _M_header->_M_left)
if (__position._M_node == this->_M_header->_M_left)
{
// begin()
if (size() > 0 &&
......@@ -1112,7 +1112,7 @@ namespace std
else
return insert_equal(__v);
}
else if (__position._M_node == _M_header)
else if (__position._M_node == this->_M_header)
{
// end()
if (!_M_key_compare(_KeyOfValue()(__v), _S_key(_M_rightmost())))
......@@ -1168,9 +1168,9 @@ namespace std
{
_Link_type __y =
(_Link_type) _Rb_tree_rebalance_for_erase(__position._M_node,
_M_header->_M_parent,
_M_header->_M_left,
_M_header->_M_right);
this->_M_header->_M_parent,
this->_M_header->_M_left,
this->_M_header->_M_right);
destroy_node(__y);
--_M_node_count;
}
......@@ -1264,7 +1264,8 @@ namespace std
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k)
{
_Link_type __y = _M_header; // Last node which is not less than __k.
_Link_type __y
= this->_M_header; // Last node which is not less than __k.
_Link_type __x = _M_root(); // Current node.
while (__x != 0)
......@@ -1284,7 +1285,8 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
find(const _Key& __k) const
{
_Link_type __y = _M_header; // Last node which is not less than __k.
_Link_type __y
= this->_M_header; // Last node which is not less than __k.
_Link_type __x = _M_root(); // Current node.
while (__x != 0)
......@@ -1316,7 +1318,8 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
lower_bound(const _Key& __k)
{
_Link_type __y = _M_header; /* Last node which is not less than __k. */
_Link_type __y
= this->_M_header; /* Last node which is not less than __k. */
_Link_type __x = _M_root(); /* Current node. */
while (__x != 0)
......@@ -1334,7 +1337,8 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
lower_bound(const _Key& __k) const
{
_Link_type __y = _M_header; /* Last node which is not less than __k. */
_Link_type __y
= this->_M_header; /* Last node which is not less than __k. */
_Link_type __x = _M_root(); /* Current node. */
while (__x != 0)
......@@ -1352,7 +1356,8 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
upper_bound(const _Key& __k)
{
_Link_type __y = _M_header; /* Last node which is greater than __k. */
_Link_type __y
= this->_M_header; /* Last node which is greater than __k. */
_Link_type __x = _M_root(); /* Current node. */
while (__x != 0)
......@@ -1370,7 +1375,8 @@ namespace std
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
upper_bound(const _Key& __k) const
{
_Link_type __y = _M_header; /* Last node which is greater than __k. */
_Link_type __y
= this->_M_header; /* Last node which is greater than __k. */
_Link_type __x = _M_root(); /* Current node. */
while (__x != 0)
......@@ -1428,7 +1434,8 @@ namespace std
{
if (_M_node_count == 0 || begin() == end())
return _M_node_count == 0 && begin() == end() &&
_M_header->_M_left == _M_header && _M_header->_M_right == _M_header;
this->_M_header->_M_left == this->_M_header
&& this->_M_header->_M_right == this->_M_header;
int __len = __black_count(_M_leftmost(), _M_root());
for (const_iterator __it = begin(); __it != end(); ++__it)
......
// Vector implementation -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
......@@ -153,13 +153,14 @@ namespace std
_Vector_base(size_t __n, const allocator_type& __a)
: _Base(__a)
{
_M_start = _M_allocate(__n);
_M_finish = _M_start;
_M_end_of_storage = _M_start + __n;
this->_M_start = _M_allocate(__n);
this->_M_finish = this->_M_start;
this->_M_end_of_storage = this->_M_start + __n;
}
~_Vector_base()
{ _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
{ _M_deallocate(this->_M_start,
this->_M_end_of_storage - this->_M_start); }
};
......@@ -238,7 +239,7 @@ namespace std
vector(size_type __n, const value_type& __value,
const allocator_type& __a = allocator_type())
: _Base(__n, __a)
{ _M_finish = uninitialized_fill_n(_M_start, __n, __value); }
{ this->_M_finish = uninitialized_fill_n(this->_M_start, __n, __value); }
/**
* @brief Create a %vector with default elements.
......@@ -250,7 +251,8 @@ namespace std
explicit
vector(size_type __n)
: _Base(__n, allocator_type())
{ _M_finish = uninitialized_fill_n(_M_start, __n, value_type()); }
{ this->_M_finish = uninitialized_fill_n(this->_M_start,
__n, value_type()); }
/**
* @brief %Vector copy constructor.
......@@ -263,7 +265,9 @@ namespace std
*/
vector(const vector& __x)
: _Base(__x.size(), __x.get_allocator())
{ _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
{ this->_M_finish = uninitialized_copy(__x.begin(), __x.end(),
this->_M_start);
}
/**
* @brief Builds a %vector from a range.
......@@ -294,7 +298,7 @@ namespace std
* themselves are pointers, the pointed-to memory is not touched in any
* way. Managing the pointer is the user's responsibilty.
*/
~vector() { _Destroy(_M_start, _M_finish); }
~vector() { _Destroy(this->_M_start, this->_M_finish); }
/**
* @brief %Vector assignment operator.
......@@ -352,7 +356,7 @@ namespace std
* %vector. Iteration is done in ordinary element order.
*/
iterator
begin() { return iterator (_M_start); }
begin() { return iterator (this->_M_start); }
/**
* Returns a read-only (constant) iterator that points to the
......@@ -360,7 +364,7 @@ namespace std
* element order.
*/
const_iterator
begin() const { return const_iterator (_M_start); }
begin() const { return const_iterator (this->_M_start); }
/**
* Returns a read/write iterator that points one past the last
......@@ -368,14 +372,14 @@ namespace std
* element order.
*/
iterator
end() { return iterator (_M_finish); }
end() { return iterator (this->_M_finish); }
/**
* Returns a read-only (constant) iterator that points one past the last
* element in the %vector. Iteration is done in ordinary element order.
*/
const_iterator
end() const { return const_iterator (_M_finish); }
end() const { return const_iterator (this->_M_finish); }
/**
* Returns a read/write reverse iterator that points to the
......@@ -457,7 +461,7 @@ namespace std
*/
size_type
capacity() const
{ return size_type(const_iterator(_M_end_of_storage) - begin()); }
{ return size_type(const_iterator(this->_M_end_of_storage) - begin()); }
/**
* Returns true if the %vector is empty. (Thus begin() would
......@@ -594,10 +598,10 @@ namespace std
void
push_back(const value_type& __x)
{
if (_M_finish != _M_end_of_storage)
if (this->_M_finish != this->_M_end_of_storage)
{
_Construct(_M_finish, __x);
++_M_finish;
_Construct(this->_M_finish, __x);
++this->_M_finish;
}
else
_M_insert_aux(end(), __x);
......@@ -614,8 +618,8 @@ namespace std
void
pop_back()
{
--_M_finish;
_Destroy(_M_finish);
--this->_M_finish;
_Destroy(this->_M_finish);
}
/**
......@@ -723,9 +727,9 @@ namespace std
void
swap(vector& __x)
{
std::swap(_M_start, __x._M_start);
std::swap(_M_finish, __x._M_finish);
std::swap(_M_end_of_storage, __x._M_end_of_storage);
std::swap(this->_M_start, __x._M_start);
std::swap(this->_M_finish, __x._M_finish);
std::swap(this->_M_end_of_storage, __x._M_end_of_storage);
}
/**
......@@ -770,9 +774,9 @@ namespace std
void
_M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
{
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_fill_n(_M_start, __n, __value);
this->_M_start = _M_allocate(__n);
this->_M_end_of_storage = this->_M_start + __n;
this->_M_finish = uninitialized_fill_n(this->_M_start, __n, __value);
}
// Called by the range constructor to implement [23.1.1]/9
......@@ -803,9 +807,10 @@ namespace std
_ForwardIterator __last, forward_iterator_tag)
{
size_type __n = std::distance(__first, __last);
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_copy(__first, __last, _M_start);
this->_M_start = _M_allocate(__n);
this->_M_end_of_storage = this->_M_start + __n;
this->_M_finish = uninitialized_copy(__first, __last,
this->_M_start);
}
......
// SGI's rope class implementation -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 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
......@@ -278,12 +278,12 @@ void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
template <class _CharT, class _Alloc>
void _Rope_iterator<_CharT,_Alloc>::_M_check() {
if (_M_root_rope->_M_tree_ptr != _M_root) {
if (_M_root_rope->_M_tree_ptr != this->_M_root) {
// _Rope was modified. Get things fixed up.
_RopeRep::_S_unref(_M_root);
_M_root = _M_root_rope->_M_tree_ptr;
_RopeRep::_S_ref(_M_root);
_M_buf_ptr = 0;
_RopeRep::_S_unref(this->_M_root);
this->_M_root = _M_root_rope->_M_tree_ptr;
_RopeRep::_S_ref(this->_M_root);
this->_M_buf_ptr = 0;
}
}
......@@ -300,7 +300,7 @@ inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator(
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
_M_root_rope(&__r)
{
_RopeRep::_S_ref(_M_root);
_RopeRep::_S_ref(this->_M_root);
}
template <class _CharT, class _Alloc>
......@@ -321,7 +321,7 @@ inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string()
{
_CharT* __cstr = _M_c_string;
if (0 != __cstr) {
size_t __size = _M_size + 1;
size_t __size = this->_M_size + 1;
_Destroy(__cstr, __cstr + __size);
_Data_deallocate(__cstr, __size);
}
......@@ -960,7 +960,7 @@ size_t
rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const
{
_Rope_find_char_char_consumer<_CharT> __c(__pattern);
_S_apply_to_pieces(__c, _M_tree_ptr, __start, size());
_S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
size_type __result_pos = __start + __c._M_count;
# ifndef __STL_OLD_ROPE_SEMANTICS
if (__result_pos == size()) __result_pos = npos;
......@@ -1436,8 +1436,8 @@ rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c,
} else {
__result = __remainder_rope;
}
_M_tree_ptr = __result._M_tree_ptr;
_M_tree_ptr->_M_ref_nonnil();
this->_M_tree_ptr = __result._M_tree_ptr;
this->_M_tree_ptr->_M_ref_nonnil();
}
template<class _CharT, class _Alloc>
......@@ -1445,22 +1445,23 @@ template<class _CharT, class _Alloc>
template<class _CharT, class _Alloc>
const _CharT* rope<_CharT,_Alloc>::c_str() const {
if (0 == _M_tree_ptr) {
if (0 == this->_M_tree_ptr) {
_S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant,
// but probably fast.
return _S_empty_c_str;
}
__GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string;
__GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;
if (0 != __old_c_string) return(__old_c_string);
size_t __s = size();
_CharT* __result = _Data_allocate(__s + 1);
_S_flatten(_M_tree_ptr, __result);
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
# ifdef __GC
_M_tree_ptr->_M_c_string = __result;
# else
if ((__old_c_string = (__GC_CONST _CharT*)
std::_Atomic_swap((unsigned long *)(&(_M_tree_ptr->_M_c_string)),
std::_Atomic_swap((unsigned long *)
(&(this->_M_tree_ptr->_M_c_string)),
(unsigned long)__result)) != 0) {
// It must have been added in the interim. Hence it had to have been
// separately allocated. Deallocate the old copy, since we just
......@@ -1474,20 +1475,21 @@ const _CharT* rope<_CharT,_Alloc>::c_str() const {
template<class _CharT, class _Alloc>
const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
if (0 == _M_tree_ptr) {
if (0 == this->_M_tree_ptr) {
_S_empty_c_str[0] = _S_eos((_CharT*)0);
return _S_empty_c_str;
}
__GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string;
if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && 0 != __old_c_string) {
__GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;
if (_RopeRep::_S_leaf == this->_M_tree_ptr->_M_tag
&& 0 != __old_c_string) {
return(__old_c_string);
}
size_t __s = size();
_CharT* __result = _Data_allocate(_S_rounded_up_size(__s));
_S_flatten(_M_tree_ptr, __result);
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
_M_tree_ptr->_M_unref_nonnil();
_M_tree_ptr = _S_new_RopeLeaf(__result, __s, get_allocator());
this->_M_tree_ptr->_M_unref_nonnil();
this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s, get_allocator());
return(__result);
}
......
// File descriptor layer for filebuf -*- C++ -*-
// Copyright (C) 2002 Free Software Foundation, Inc.
// Copyright (C) 2002, 2003 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
......@@ -107,7 +107,7 @@ namespace __gnu_cxx
*/
int
fd()
{ return _M_file.fd(); }
{ return this->_M_file.fd(); }
};
template<typename _CharT, typename _Traits>
......@@ -119,20 +119,20 @@ namespace __gnu_cxx
stdio_filebuf(int __fd, std::ios_base::openmode __mode, bool __del,
int_type __size)
{
_M_file.sys_open(__fd, __mode, __del);
this->_M_file.sys_open(__fd, __mode, __del);
if (this->is_open())
{
_M_mode = __mode;
this->_M_mode = __mode;
if (__size > 0 && __size < 4)
{
// Specify unbuffered.
_M_buf = _M_unbuf;
_M_buf_size = __size;
_M_buf_size_opt = 0;
this->_M_buf = _M_unbuf;
this->_M_buf_size = __size;
this->_M_buf_size_opt = 0;
}
else
{
_M_buf_size_opt = __size;
this->_M_buf_size_opt = __size;
_M_allocate_internal_buffer();
}
_M_set_indeterminate();
......@@ -144,20 +144,20 @@ namespace __gnu_cxx
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
int_type __size)
{
_M_file.sys_open(__f, __mode);
this->_M_file.sys_open(__f, __mode);
if (this->is_open())
{
_M_mode = __mode;
this->_M_mode = __mode;
if (__size > 0 && __size < 4)
{
// Specify unbuffered.
_M_buf = _M_unbuf;
_M_buf_size = __size;
_M_buf_size_opt = 0;
this->_M_buf = _M_unbuf;
this->_M_buf_size = __size;
this->_M_buf_size_opt = 0;
}
else
{
_M_buf_size_opt = __size;
this->_M_buf_size_opt = __size;
_M_allocate_internal_buffer();
}
_M_set_indeterminate();
......
// File based streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -311,14 +311,15 @@ namespace std
virtual int
sync()
{
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
bool __testput = this->_M_out_cur
&& this->_M_out_beg < this->_M_out_end;
// Make sure that the internal buffer resyncs its idea of
// the file position with the external file.
if (__testput)
{
// Need to restore current position after the write.
off_type __off = _M_out_cur - _M_out_end;
off_type __off = this->_M_out_cur - this->_M_out_end;
_M_really_overflow(); // _M_file.sync() will be called within
if (__off)
_M_file.seekoff(__off, ios_base::cur);
......@@ -339,14 +340,14 @@ namespace std
{
streamsize __ret = 0;
// Clear out pback buffer before going on to the real deal...
if (_M_pback_init)
if (this->_M_pback_init)
{
while (__ret < __n && _M_in_cur < _M_in_end)
while (__ret < __n && this->_M_in_cur < this->_M_in_end)
{
*__s = *_M_in_cur;
*__s = *this->_M_in_cur;
++__ret;
++__s;
++_M_in_cur;
++this->_M_in_cur;
}
_M_pback_destroy();
}
......@@ -386,11 +387,11 @@ namespace std
void
_M_set_indeterminate(void)
{
if (_M_mode & ios_base::in)
this->setg(_M_buf, _M_buf, _M_buf);
if (_M_mode & ios_base::out)
this->setp(_M_buf, _M_buf);
_M_filepos = _M_buf;
if (this->_M_mode & ios_base::in)
this->setg(this->_M_buf, this->_M_buf, this->_M_buf);
if (this->_M_mode & ios_base::out)
this->setp(this->_M_buf, this->_M_buf);
_M_filepos = this->_M_buf;
}
/**
......@@ -401,13 +402,13 @@ namespace std
void
_M_set_determinate(off_type __off)
{
bool __testin = _M_mode & ios_base::in;
bool __testout = _M_mode & ios_base::out;
bool __testin = this->_M_mode & ios_base::in;
bool __testout = this->_M_mode & ios_base::out;
if (__testin)
this->setg(_M_buf, _M_buf, _M_buf + __off);
this->setg(this->_M_buf, this->_M_buf, this->_M_buf + __off);
if (__testout)
this->setp(_M_buf, _M_buf + __off);
_M_filepos = _M_buf + __off;
this->setp(this->_M_buf, this->_M_buf + __off);
_M_filepos = this->_M_buf + __off;
}
/**
......@@ -420,12 +421,14 @@ namespace std
{
bool __ret = false;
// Don't return true if unbuffered.
if (_M_buf)
if (this->_M_buf)
{
if (_M_mode & ios_base::in)
__ret = _M_in_beg == _M_in_cur && _M_in_cur == _M_in_end;
if (_M_mode & ios_base::out)
__ret = _M_out_beg == _M_out_cur && _M_out_cur == _M_out_end;
if (this->_M_mode & ios_base::in)
__ret = this->_M_in_beg == this->_M_in_cur
&& this->_M_in_cur == this->_M_in_end;
if (this->_M_mode & ios_base::out)
__ret = this->_M_out_beg == this->_M_out_cur
&& this->_M_out_cur == this->_M_out_end;
}
return __ret;
}
......
// String based streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
// Copyright (C) 1997, 1998, 1999, 2002, 2003 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
......@@ -133,16 +133,17 @@ namespace std
__string_type
str() const
{
if (_M_mode & ios_base::out)
if (this->_M_mode & ios_base::out)
{
// This is the deal: _M_string.size() is a value that
// represents the size of the initial string that makes
// _M_string, and may not be the correct size of the
// current stringbuf internal buffer.
__size_type __len = _M_string.size();
if (_M_out_cur > _M_out_beg)
__len = std::max(__size_type(_M_out_end - _M_out_beg), __len);
return __string_type(_M_out_beg, _M_out_beg + __len);
if (this->_M_out_cur > this->_M_out_beg)
__len = std::max(__size_type(this->_M_out_end
- this->_M_out_beg), __len);
return __string_type(this->_M_out_beg, this->_M_out_beg + __len);
}
else
return _M_string;
......@@ -160,7 +161,7 @@ namespace std
{
// Cannot use _M_string = __s, since v3 strings are COW.
_M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode);
_M_stringbuf_init(this->_M_mode);
}
protected:
......@@ -178,16 +179,16 @@ namespace std
// necessary as ostringstreams are implemented with the
// streambufs having control of the allocation and
// re-allocation of the internal string object, _M_string.
_M_buf_size = _M_string.size();
this->_M_buf_size = _M_string.size();
// NB: Start ostringstream buffers at 512 bytes. This is an
// experimental value (pronounced "arbitrary" in some of the
// hipper english-speaking countries), and can be changed to
// suit particular needs.
_M_buf_size_opt = 512;
_M_mode = __mode;
if (_M_mode & (ios_base::ate | ios_base::app))
_M_really_sync(0, _M_buf_size);
this->_M_buf_size_opt = 512;
this->_M_mode = __mode;
if (this->_M_mode & (ios_base::ate | ios_base::app))
_M_really_sync(0, this->_M_buf_size);
else
_M_really_sync(0, 0);
}
......@@ -197,7 +198,7 @@ namespace std
virtual int_type
underflow()
{
if (_M_in_cur && _M_in_cur < _M_in_end)
if (this->_M_in_cur && this->_M_in_cur < this->_M_in_end)
return traits_type::to_int_type(*gptr());
else
return traits_type::eof();
......@@ -258,17 +259,17 @@ namespace std
_M_really_sync(__size_type __i, __size_type __o)
{
char_type* __base = const_cast<char_type*>(_M_string.data());
bool __testin = _M_mode & ios_base::in;
bool __testout = _M_mode & ios_base::out;
bool __testin = this->_M_mode & ios_base::in;
bool __testout = this->_M_mode & ios_base::out;
__size_type __len = _M_string.size();
_M_buf = __base;
this->_M_buf = __base;
if (__testin)
this->setg(__base, __base + __i, __base + __len);
if (__testout)
{
this->setp(__base, __base + __len);
_M_out_cur += __o;
this->_M_out_cur += __o;
}
return 0;
}
......
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