From 8cd4c1752846cea2517c93a71c33bcc8e25a063c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 17 Aug 1998 17:13:42 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 11 +++++++ gcc/cp/call.c | 8 +----- gcc/cp/cvt.c | 8 +----- gcc/cp/decl.c | 1 + gcc/cp/decl2.c | 3 +- gcc/cp/gxxint.texi | 71 ---------------------------------------------- gcc/cp/tree.c | 6 ++-- gcc/cp/typeck.c | 16 ++--------- 8 files changed, 21 insertions(+), 103 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1379f0741c2..58ee77c9042 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,16 @@ 1998-08-17 Jason Merrill + * 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. * lex.c (do_scoped_id): Use cp_error. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e65898eaf7d..5234a4b1762 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1144,15 +1144,9 @@ add_function_candidate (candidates, fn, arglist, flags) for (i = 0; i < len; ++i) { tree arg = TREE_VALUE (argnode); - tree argtype = TREE_TYPE (arg); + tree argtype = lvalue_type (arg); 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) break; else if (parmnode) diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 1078488c293..1c6447a61b7 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -448,13 +448,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl) if (flags & LOOKUP_COMPLAIN) { tree ttl = TREE_TYPE (reftype); - tree ttr; - - { - int r = TREE_READONLY (expr); - int v = TREE_THIS_VOLATILE (expr); - ttr = cp_build_type_variant (TREE_TYPE (expr), r, v); - } + tree ttr = lvalue_type (expr); if (! real_lvalue_p (expr) && ! TYPE_READONLY (ttl)) { diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ccaf75732d3..932fb694ad9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11891,6 +11891,7 @@ finish_enum (enumtype, values) TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype); TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype); TYPE_SIZE (tem) = TYPE_SIZE (enumtype); + TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype); TYPE_MODE (tem) = TYPE_MODE (enumtype); TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype); TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4ffba6fabc0..6ac0beeb184 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -541,8 +541,7 @@ lang_decode_option (argc, argv) #endif /* ! USE_CPPLIB */ if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) - flag_writable_strings = 1, - flag_this_is_variable = 1, flag_new_for_scope = 0; + /* ignore */; /* The +e options are for cfront compatibility. They come in as `-+eN', to kludge around gcc.c's argument handling. */ else if (p[0] == '-' && p[1] == '+' && p[2] == 'e') diff --git a/gcc/cp/gxxint.texi b/gcc/cp/gxxint.texi index 7cb57f2665c..c8f312ebfca 100644 --- a/gcc/cp/gxxint.texi +++ b/gcc/cp/gxxint.texi @@ -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 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 The use of @code{explicit} on a constructor is used by @code{grokdeclarator} diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8b782bbb85c..685810ae504 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2368,8 +2368,10 @@ lvalue_type (arg) tree type = TREE_TYPE (arg); if (TREE_CODE (arg) == OVERLOAD) type = unknown_type_node; - return cp_build_type_variant - (type, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg)); + if (TREE_CODE (type) != ARRAY_TYPE) + type = cp_build_type_variant + (type, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg)); + return type; } /* The type of ARG for printing error messages; denote lvalues with diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 008a3157a52..1fa589c54b0 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4506,12 +4506,12 @@ build_unary_op (code, xarg, noconvert) /* Note that this operation never does default_conversion regardless of NOCONVERT. */ - argtype = TREE_TYPE (arg); + argtype = lvalue_type (arg); if (TREE_CODE (argtype) == REFERENCE_TYPE) { arg = build1 (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)); return arg; } @@ -4639,18 +4639,6 @@ build_unary_op (code, xarg, noconvert) && !lvalue_or_else (arg, "unary `&'")) 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); if (mark_addressable (arg) == 0)