Commit 8cd4c175 by Jason Merrill Committed by Jason Merrill

gxxint.texi: Remove obsolete documentation of overloading code.

	* gxxint.texi: Remove obsolete documentation of overloading code.
	* decl.c (finish_enum): Also set TYPE_SIZE_UNIT.
	* tree.c (lvalue_type): Fix for arrays.
	* typeck.c (build_unary_op): Use lvalue_type.
	* call.c (add_function_candidate): Likewise.
	* cvt.c (convert_to_reference): Likewise.
	* decl2.c (lang_decode_option): Ignore -traditional.

From-SVN: r21795
parent 2e245dac
1998-08-17 Jason Merrill <jason@yorick.cygnus.com> 1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
* gxxint.texi: Remove obsolete documentation of overloading code.
* decl.c (finish_enum): Also set TYPE_SIZE_UNIT.
* tree.c (lvalue_type): Fix for arrays.
* typeck.c (build_unary_op): Use lvalue_type.
* call.c (add_function_candidate): Likewise.
* cvt.c (convert_to_reference): Likewise.
* decl2.c (lang_decode_option): Ignore -traditional.
* init.c (build_offset_ref): Don't mess with error_mark_node. * init.c (build_offset_ref): Don't mess with error_mark_node.
* lex.c (do_scoped_id): Use cp_error. * lex.c (do_scoped_id): Use cp_error.
......
...@@ -1144,15 +1144,9 @@ add_function_candidate (candidates, fn, arglist, flags) ...@@ -1144,15 +1144,9 @@ add_function_candidate (candidates, fn, arglist, flags)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
{ {
tree arg = TREE_VALUE (argnode); tree arg = TREE_VALUE (argnode);
tree argtype = TREE_TYPE (arg); tree argtype = lvalue_type (arg);
tree t; tree t;
/* An overloaded function does not have an argument type */
if (TREE_CODE (arg) == OVERLOAD)
argtype = unknown_type_node;
argtype = cp_build_type_variant
(argtype, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
if (parmnode == void_list_node) if (parmnode == void_list_node)
break; break;
else if (parmnode) else if (parmnode)
......
...@@ -448,13 +448,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl) ...@@ -448,13 +448,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
if (flags & LOOKUP_COMPLAIN) if (flags & LOOKUP_COMPLAIN)
{ {
tree ttl = TREE_TYPE (reftype); tree ttl = TREE_TYPE (reftype);
tree ttr; tree ttr = lvalue_type (expr);
{
int r = TREE_READONLY (expr);
int v = TREE_THIS_VOLATILE (expr);
ttr = cp_build_type_variant (TREE_TYPE (expr), r, v);
}
if (! real_lvalue_p (expr) && ! TYPE_READONLY (ttl)) if (! real_lvalue_p (expr) && ! TYPE_READONLY (ttl))
{ {
......
...@@ -11891,6 +11891,7 @@ finish_enum (enumtype, values) ...@@ -11891,6 +11891,7 @@ finish_enum (enumtype, values)
TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype); TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype);
TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype); TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype);
TYPE_SIZE (tem) = TYPE_SIZE (enumtype); TYPE_SIZE (tem) = TYPE_SIZE (enumtype);
TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype);
TYPE_MODE (tem) = TYPE_MODE (enumtype); TYPE_MODE (tem) = TYPE_MODE (enumtype);
TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype); TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype); TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
......
...@@ -541,8 +541,7 @@ lang_decode_option (argc, argv) ...@@ -541,8 +541,7 @@ lang_decode_option (argc, argv)
#endif /* ! USE_CPPLIB */ #endif /* ! USE_CPPLIB */
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
flag_writable_strings = 1, /* ignore */;
flag_this_is_variable = 1, flag_new_for_scope = 0;
/* The +e options are for cfront compatibility. They come in as /* The +e options are for cfront compatibility. They come in as
`-+eN', to kludge around gcc.c's argument handling. */ `-+eN', to kludge around gcc.c's argument handling. */
else if (p[0] == '-' && p[1] == '+' && p[2] == 'e') else if (p[0] == '-' && p[1] == '+' && p[2] == 'e')
......
...@@ -167,77 +167,6 @@ class foo @{ public: int b; int a; foo (); @}; ...@@ -167,77 +167,6 @@ class foo @{ public: int b; int a; foo (); @};
Thus, @samp{b} will be initialized with 2 first, then @samp{a} will be Thus, @samp{b} will be initialized with 2 first, then @samp{a} will be
initialized with 1, regardless of how they're listed in the mem-initializer. initialized with 1, regardless of how they're listed in the mem-initializer.
@item Argument Matching
In early 1993, the argument matching scheme in @sc{gnu} C++ changed
significantly. The original code was completely replaced with a new
method that will, hopefully, be easier to understand and make fixing
specific cases much easier.
The @samp{-fansi-overloading} option is used to enable the new code; at
some point in the future, it will become the default behavior of the
compiler.
The file @file{cp-call.c} contains all of the new work, in the functions
@code{rank_for_overload}, @code{compute_harshness},
@code{compute_conversion_costs}, and @code{ideal_candidate}.
Instead of using obscure numerical values, the quality of an argument
match is now represented by clear, individual codes. The new data
structure @code{struct harshness} (it used to be an @code{unsigned}
number) contains:
@enumerate a
@item the @samp{code} field, to signify what was involved in matching two
arguments;
@item the @samp{distance} field, used in situations where inheritance
decides which function should be called (one is ``closer'' than
another);
@item and the @samp{int_penalty} field, used by some codes as a tie-breaker.
@end enumerate
The @samp{code} field is a number with a given bit set for each type of
code, OR'd together. The new codes are:
@itemize @bullet
@item @code{EVIL_CODE}
The argument was not a permissible match.
@item @code{CONST_CODE}
Currently, this is only used by @code{compute_conversion_costs}, to
distinguish when a non-@code{const} member function is called from a
@code{const} member function.
@item @code{ELLIPSIS_CODE}
A match against an ellipsis @samp{...} is considered worse than all others.
@item @code{USER_CODE}
Used for a match involving a user-defined conversion.
@item @code{STD_CODE}
A match involving a standard conversion.
@item @code{PROMO_CODE}
A match involving an integral promotion. For these, the
@code{int_penalty} field is used to handle the ARM's rule (XXX cite)
that a smaller @code{unsigned} type should promote to a @code{int}, not
to an @code{unsigned int}.
@item @code{QUAL_CODE}
Used to mark use of qualifiers like @code{const} and @code{volatile}.
@item @code{TRIVIAL_CODE}
Used for trivial conversions. The @samp{int_penalty} field is used by
@code{convert_harshness} to communicate further penalty information back
to @code{build_overload_call_real} when deciding which function should
be call.
@end itemize
The functions @code{convert_to_aggr} and @code{build_method_call} use
@code{compute_conversion_costs} to rate each argument's suitability for
a given candidate function (that's how we get the list of candidates for
@code{ideal_candidate}).
@item The Explicit Keyword @item The Explicit Keyword
The use of @code{explicit} on a constructor is used by @code{grokdeclarator} The use of @code{explicit} on a constructor is used by @code{grokdeclarator}
......
...@@ -2368,8 +2368,10 @@ lvalue_type (arg) ...@@ -2368,8 +2368,10 @@ lvalue_type (arg)
tree type = TREE_TYPE (arg); tree type = TREE_TYPE (arg);
if (TREE_CODE (arg) == OVERLOAD) if (TREE_CODE (arg) == OVERLOAD)
type = unknown_type_node; type = unknown_type_node;
return cp_build_type_variant if (TREE_CODE (type) != ARRAY_TYPE)
type = cp_build_type_variant
(type, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg)); (type, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
return type;
} }
/* The type of ARG for printing error messages; denote lvalues with /* The type of ARG for printing error messages; denote lvalues with
......
...@@ -4506,12 +4506,12 @@ build_unary_op (code, xarg, noconvert) ...@@ -4506,12 +4506,12 @@ build_unary_op (code, xarg, noconvert)
/* Note that this operation never does default_conversion /* Note that this operation never does default_conversion
regardless of NOCONVERT. */ regardless of NOCONVERT. */
argtype = TREE_TYPE (arg); argtype = lvalue_type (arg);
if (TREE_CODE (argtype) == REFERENCE_TYPE) if (TREE_CODE (argtype) == REFERENCE_TYPE)
{ {
arg = build1 arg = build1
(CONVERT_EXPR, (CONVERT_EXPR,
build_pointer_type (TREE_TYPE (TREE_TYPE (arg))), arg); build_pointer_type (TREE_TYPE (argtype)), arg);
TREE_CONSTANT (arg) = TREE_CONSTANT (TREE_OPERAND (arg, 0)); TREE_CONSTANT (arg) = TREE_CONSTANT (TREE_OPERAND (arg, 0));
return arg; return arg;
} }
...@@ -4639,18 +4639,6 @@ build_unary_op (code, xarg, noconvert) ...@@ -4639,18 +4639,6 @@ build_unary_op (code, xarg, noconvert)
&& !lvalue_or_else (arg, "unary `&'")) && !lvalue_or_else (arg, "unary `&'"))
return error_mark_node; return error_mark_node;
/* Ordinary case; arg is a COMPONENT_REF or a decl. */
/* If the lvalue is const or volatile,
merge that into the type that the address will point to. */
if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd'
|| TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
{
if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
argtype = cp_build_type_variant (argtype,
TREE_READONLY (arg),
TREE_THIS_VOLATILE (arg));
}
argtype = build_pointer_type (argtype); argtype = build_pointer_type (argtype);
if (mark_addressable (arg) == 0) if (mark_addressable (arg) == 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