From fa56377de3213de3b1f2cc263cfda2843a610685 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 3 Aug 1999 01:14:12 +0200 Subject: [PATCH] Jakub Jelinek * call.c (convert_default_arg, build_over_call): Change all uses of PROMOTE_PROTOTYPES, so that it tests it as a C expression. Ensure expr.h is included. * decl.c (grokparams): Ditto. * pt.c (tsubst_decl): Ditto. * typeck.c (convert_arguments): Ditto. From-SVN: r28418 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/call.c | 15 +++++++-------- gcc/cp/decl.c | 8 ++++---- gcc/cp/pt.c | 8 ++++---- gcc/cp/typeck.c | 7 +++---- 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9ba2082157f..0858a28d322 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +1999-08-02 Jakub Jelinek + + * call.c (convert_default_arg, build_over_call): Change all uses of + PROMOTE_PROTOTYPES, so that it tests it as a C expression. + Ensure expr.h is included. + * decl.c (grokparams): Ditto. + * pt.c (tsubst_decl): Ditto. + * typeck.c (convert_arguments): Ditto. + 1999-08-02 Jason Merrill * class.c (mark_overriders): Fix order of args to overrides. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4ab496888fc..1a5f9fe550d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "rtl.h" #include "toplev.h" +#include "expr.h" #include "obstack.h" #define obstack_chunk_alloc xmalloc @@ -3827,12 +3828,11 @@ convert_default_arg (type, arg, fn) arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL, "default argument", 0, 0); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) + if (PROMOTE_PROTOTYPES + && (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) arg = default_conversion (arg); -#endif } return arg; @@ -3943,12 +3943,11 @@ build_over_call (cand, args, flags) val = convert_like (conv, TREE_VALUE (arg)); } -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) + if (PROMOTE_PROTOTYPES + && (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) val = default_conversion (val); -#endif converted_args = expr_tree_cons (NULL_TREE, val, converted_args); } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index bbbf7be89e1..94a010f16d3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -42,6 +42,7 @@ Boston, MA 02111-1307, USA. */ #include "except.h" #include "toplev.h" #include "../hash.h" +#include "expr.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -11652,12 +11653,11 @@ grokparms (first_parm, funcdef_flag) /* Since there is a prototype, args are passed in their own types. */ DECL_ARG_TYPE (decl) = TREE_TYPE (decl); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) + if (PROMOTE_PROTOTYPES + && (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) DECL_ARG_TYPE (decl) = integer_type_node; -#endif if (!any_error && init) { any_init++; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e5e5d7ef674..d3f1a7e6f78 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "rtl.h" #include "varray.h" +#include "expr.h" /* The type of functions taking a tree, and some additional data, and returning an int. */ @@ -5839,12 +5840,11 @@ tsubst_decl (t, args, type, in_decl) /*complain=*/1, in_decl); DECL_CONTEXT (r) = NULL_TREE; -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) + if (PROMOTE_PROTOTYPES + && (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) DECL_ARG_TYPE (r) = integer_type_node; -#endif if (TREE_CHAIN (t)) TREE_CHAIN (r) = tsubst (TREE_CHAIN (t), args, /*complain=*/1, TREE_CHAIN (t)); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index cd0652f7529..2b268f85b9d 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3204,13 +3204,12 @@ convert_arguments (typelist, values, fndecl, flags) parmval = convert_for_initialization (NULL_TREE, type, val, flags, "argument passing", fndecl, i); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) + if (PROMOTE_PROTOTYPES + && (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == ENUMERAL_TYPE) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) parmval = default_conversion (parmval); -#endif } if (parmval == error_mark_node) -- 2.30.2