Commit 7d473569 by Jakub Jelinek Committed by Richard Henderson

Jakub Jelinek <jj@ultra.linux.cz>

        * c-decl.c (get_parm_info, store_parm_decls): Change all uses of
        PROMOTE_PROTOTYPES, so that it tests it as a C expression.
        Ensure expr.h is included.
        * c-typecheck.c (convert_arguments): Ditto.

        * expr.h: Supply default for PROMOTE_PROTOTYPES (0).

From-SVN: r28420
parent e438e1b7
1999-08-02 Jakub Jelinek <jj@ultra.linux.cz>
* c-decl.c (get_parm_info, store_parm_decls): Change all uses of
PROMOTE_PROTOTYPES, so that it tests it as a C expression.
Ensure expr.h is included.
* c-typecheck.c (convert_arguments): Ditto.
* expr.h: Supply default for PROMOTE_PROTOTYPES (0).
* config/arc/arc.h: Define PROMOTE_PROTOTYPES to 1.
* config/convex/convex.h: Ditto.
* config/dsp16xx/dsp16xx.h: Ditto.
* config/fx80/fx80.h: Ditto.
* config/gmicro/gmicro.h: Ditto.
* config/i370/i370.h: Ditto.
* config/i386/i386.h: Ditto.
* config/m32r/m32r.h: Ditto.
* config/m68k/m68k.h: Ditto.
* config/m88k/m88k.h: Ditto.
* config/mips/mips.h: Ditto.
* config/pa/pa.h: Ditto.
* config/pyr/pyr.h: Ditto.
* config/tahoe/tahoe.h: Ditto.
* config/we32k/we32k.h: Ditto.
* config/sparc/sparc.h: Define PROMOTE_PROTOTYPES
based on arch size.
* config/i1750a/i1750a.h: Define PROMOTE_PROTOTYPES to 0.
* config/i860/paragon.h: Remove PROMOTE_PROTOTYPES
from comment.
* tm.texi: Document new usage of PROMOTE_PROTOTYPES.
1999-08-02 Richard Henderson <rth@cygnus.com>
* m32r.c (m32r_setup_incoming_varargs): Use get_varargs_alias_set
......
......@@ -34,6 +34,7 @@ Boston, MA 02111-1307, USA. */
#include "c-tree.h"
#include "c-lex.h"
#include "toplev.h"
#include "expr.h"
#if USE_CPPLIB
#include "cpplib.h"
......@@ -5219,12 +5220,11 @@ get_parm_info (void_at_end)
args are passed in their declared types. */
tree type = TREE_TYPE (decl);
DECL_ARG_TYPE (decl) = type;
#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
types = saveable_tree_cons (NULL_TREE, TREE_TYPE (decl), types);
if (TYPE_MAIN_VARIANT (TREE_VALUE (types)) == void_type_node && ! erred
......@@ -6557,13 +6557,14 @@ store_parm_decls ()
`int foo(float x) {...}'. This is particularly
useful for argument types like uid_t. */
DECL_ARG_TYPE (parm) = TREE_TYPE (parm);
#ifdef PROMOTE_PROTOTYPES
if ((TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == ENUMERAL_TYPE)
if (PROMOTE_PROTOTYPES
&& (TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == ENUMERAL_TYPE)
&& TYPE_PRECISION (TREE_TYPE (parm))
< TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (parm) = integer_type_node;
#endif
if (pedantic)
{
pedwarn ("promoted argument `%s' doesn't match prototype",
......
......@@ -1682,12 +1682,11 @@ convert_arguments (typelist, values, name, fundecl)
(char *) 0, /* arg passing */
fundecl, name, parmnum + 1);
#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
}
result = tree_cons (NULL_TREE, parmval, result);
}
......
......@@ -251,6 +251,11 @@ enum direction {none, upward, downward}; /* Value has this type. */
#define PRETEND_OUTGOING_VARARGS_NAMED 0
#endif
/* Supply a default definition for PROMOTE_PROTOTYPES. */
#ifndef PROMOTE_PROTOTYPES
#define PROMOTE_PROTOTYPES 0
#endif
/* Nonzero if we do not know how to pass TYPE solely in registers.
We cannot do so in the following cases:
......
......@@ -2608,10 +2608,12 @@ control passing certain arguments in registers.
@table @code
@findex PROMOTE_PROTOTYPES
@item PROMOTE_PROTOTYPES
Define this macro if an argument declared in a prototype as an
integral type smaller than @code{int} should actually be passed as an
@code{int}. In addition to avoiding errors in certain cases of
mismatch, it also makes for better code on certain machines.
A C expression whose value is nonzero if an argument declared in
a prototype as an integral type smaller than @code{int} should
actually be passed as an @code{int}. In addition to avoiding
errors in certain cases of mismatch, it also makes for better
code on certain machines. If the macro is not defined in target
header files, it defaults to 0.
@findex PUSH_ROUNDING
@item PUSH_ROUNDING (@var{npushed})
......
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