summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-02 23:17:06 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-02 23:17:06 +0000
commit635ff2b73ca9e68ef0509008c9d261b4efc55f8d (patch)
tree7a67b77ab73f97ff628e4f1a4e684f4e27bea700 /gcc
parentbf5e670001a032c33b28f779088b8915c883f2f6 (diff)
downloadgcc-635ff2b73ca9e68ef0509008c9d261b4efc55f8d.tar.gz
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). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog35
-rw-r--r--gcc/c-decl.c17
-rw-r--r--gcc/c-typeck.c7
-rw-r--r--gcc/expr.h5
-rw-r--r--gcc/tm.texi10
5 files changed, 58 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 840602bda91..69857347cdf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,38 @@
+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
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index fd573340e1e..2c1dacdbccc 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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",
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 6d4c7df75fe..1d9e9e37caf 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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);
}
diff --git a/gcc/expr.h b/gcc/expr.h
index 7f1396d7d70..6bc7bb9939b 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -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:
diff --git a/gcc/tm.texi b/gcc/tm.texi
index 32593d9c7a5..0704ff5925c 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -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})