This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PROMOTE_PROTOTYPES runtime selection
> > I've got a minor question. Why not make PROMOTE_PROTOTYPES be defined
> > for all ports by defaulting it to zero somewhare? Then, all the
> > #ifdef PROMOTE_PROTOTYPES could go, and we would just have:
> >
> > if (PROMOTE_PROTOTYPES && ...)
> >
> > which would yield much more attractive code. When PROMOTE_PROTOTYPES
> > is zero, the compiler will remove the conditionalized code.
> >
> > In general, avoiding conditional compilation is probably a good thing:
> > if nothing else it keeps us from accidentally preventing some port
> > slightly different than our own from compiling when we change
> > something.
> Agreed 100%.
I fully agree as well, so here is an updated patch:
Fri Jun 3 22:46:13 1999 Jakub Jelinek (jj@ultra.linux.cz)
* cp/call.c (convert_default_arg, build_over_call):
Change all uses of PROMOTE_PROTOTYPES, so that it
tests it as a C expression to see whether prototype
promotion is required.
* cp/decl.c (grokparams): Ditto.
* cp/pt.c (tsubst_decl): Ditto.
* cp/typeck.c (convert_arguments): Ditto.
* java/decl.c (start_java_method): Ditto.
* java/expr.c (pop_arguments): Ditto.
* c-decl.c (get_parm_info, store_parm_decls): Ditto.
* c-typecheck.c (convert_arguments): Ditto.
* 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/a29k/a29k.h: Ditto.
* config/alpha/alpha.h: Ditto.
* config/c4x/c4x.h: Ditto.
* config/clipper/clipper.h: Ditto.
* config/elxsi/elxsi.h: Ditto.
* config/h8300/h8300.h: Ditto.
* config/i860/i860.h: Ditto.
* config/i960/i960.h: Ditto.
* config/ns32k/ns32k.h: Ditto.
* config/pdp11/pdp11.h: Ditto.
* config/romp/romp.h: Ditto.
* config/rs6000/rs6000.h: Ditto.
* config/spur/spur.h: Ditto.
* config/vax/vax.h: Ditto.
* config/i860/paragon.h: Remove PROMOTE_PROTOTYPES
from comment.
* tm.texi: Document new usage of PROMOTE_PROTOTYPES.
--- ./cp/call.c.jjm Fri May 28 07:34:31 1999
+++ ./cp/call.c Thu Jun 3 22:03:08 1999
@@ -3097,12 +3097,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;
@@ -3213,12 +3212,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);
}
--- ./cp/decl.c.jjm Fri May 28 07:34:40 1999
+++ ./cp/decl.c Thu Jun 3 22:03:31 1999
@@ -11943,12 +11995,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++;
--- ./cp/pt.c.jjm Fri May 28 07:35:05 1999
+++ ./cp/pt.c Thu Jun 3 22:03:48 1999
@@ -5787,12 +5787,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));
--- ./cp/typeck.c.jjm Fri May 28 07:35:15 1999
+++ ./cp/typeck.c Thu Jun 3 22:04:14 1999
@@ -3180,13 +3180,12 @@ convert_arguments (typelist, values, fnd
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)
--- ./java/decl.c.jjm Fri May 28 07:36:21 1999
+++ ./java/decl.c Thu Jun 3 22:04:49 1999
@@ -1609,11 +1609,10 @@ start_java_method (fndecl)
parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
DECL_CONTEXT (parm_decl) = fndecl;
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
+ if (PROMOTE_PROTOTYPES
+ && TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
&& INTEGRAL_TYPE_P (parm_type))
parm_type = integer_type_node;
-#endif
DECL_ARG_TYPE (parm_decl) = parm_type;
*ptr = parm_decl;
--- ./java/expr.c.jjm Fri May 28 07:36:23 1999
+++ ./java/expr.c Thu Jun 3 22:05:25 1999
@@ -1390,11 +1390,10 @@ pop_arguments (arg_types)
tree tail = pop_arguments (TREE_CHAIN (arg_types));
tree type = TREE_VALUE (arg_types);
tree arg = pop_value (type);
-#ifdef PROMOTE_PROTOTYPES
- if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
+ if (PROMOTE_PROTOTYPES
+ && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
&& INTEGRAL_TYPE_P (type))
arg = convert (integer_type_node, arg);
-#endif
return tree_cons (NULL_TREE, arg, tail);
}
abort ();
--- ./config/1750a/1750a.h.jjm Mon Mar 22 01:08:23 1999
+++ ./config/1750a/1750a.h Thu Jun 3 22:15:50 1999
@@ -879,8 +879,8 @@ enum reg_class { NO_REGS, R2, R0_1, INDE
#define STORE_FLAG_VALUE 1
/* When a prototype says `char' or `short', really pass an `int'.
- 1750: for now, `char' is 16 bits wide anyway.
- #define PROMOTE_PROTOTYPES */
+ 1750: for now, `char' is 16 bits wide anyway. */
+#define PROMOTE_PROTOTYPES 0
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/a29k/a29k.h.jjm Thu Jun 3 22:17:19 1999
+++ ./config/a29k/a29k.h Thu Jun 3 22:16:43 1999
@@ -1286,6 +1286,11 @@ extern char *a29k_function_name;
#define STORE_FLAG_VALUE (-2147483647 - 1)
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/alpha/alpha.h.jjm Thu Jun 3 22:17:33 1999
+++ ./config/alpha/alpha.h Thu Jun 3 22:18:45 1999
@@ -1702,6 +1702,11 @@ do { \
#define FLOAT_STORE_FLAG_VALUE (TARGET_FLOAT_VAX ? 0.5 : 2.0)
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Canonicalize a comparison from one we don't have to one we do have. */
#define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
--- ./config/arc/arc.h.jjm Wed Dec 16 22:01:18 1998
+++ ./config/arc/arc.h Fri May 28 17:35:53 1999
@@ -634,7 +634,7 @@ extern enum reg_class arc_regno_reg_clas
/* Function argument passing. */
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* If defined, the maximum amount of space required for outgoing
arguments will be computed and placed into the variable
--- ./config/c4x/c4x.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/c4x/c4x.h Thu Jun 3 22:27:01 1999
@@ -2401,6 +2401,11 @@ do { fprintf (asm_out_file, "\t.sdef\t")
#define DEFAULT_SIGNED_CHAR 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* A function address in a call instruction is a byte address (for
indexing purposes) so give the MEM rtx a byte's mode. */
--- ./config/clipper/clipper.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/clipper/clipper.h Thu Jun 3 22:27:21 1999
@@ -839,6 +839,11 @@ do \
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/convex/convex.h.jjm Wed Dec 16 22:02:25 1998
+++ ./config/convex/convex.h Fri May 28 17:37:09 1999
@@ -1077,7 +1077,7 @@ enum reg_class {
#define NO_FUNCTION_CSE
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/dsp16xx/dsp16xx.h.jjm Wed Jan 27 02:43:04 1999
+++ ./config/dsp16xx/dsp16xx.h Fri May 28 17:37:46 1999
@@ -1940,7 +1940,7 @@ const_section ()
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* An alias for the machine mode used for pointers */
#define Pmode QImode
--- ./config/elxsi/elxsi.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/elxsi/elxsi.h Thu Jun 3 22:27:38 1999
@@ -656,6 +656,11 @@ enum reg_class { NO_REGS, GENERAL_REGS,
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/fx80/fx80.h.jjm Mon Mar 22 01:08:17 1999
+++ ./config/fx80/fx80.h Fri May 28 17:38:01 1999
@@ -858,7 +858,7 @@ extern enum reg_class regno_reg_class[];
#define STORE_FLAG_VALUE -1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/gmicro/gmicro.h.jjm Wed Dec 16 22:02:48 1998
+++ ./config/gmicro/gmicro.h Fri May 28 17:38:19 1999
@@ -1160,7 +1160,7 @@ extern enum reg_class regno_reg_class[];
/* #define STORE_FLAG_VALUE -1 */
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/h8300/h8300.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/h8300/h8300.h Thu Jun 3 22:27:55 1999
@@ -915,6 +915,11 @@ struct rtx_def *function_arg();
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/i370/i370.h.jjm Mon Mar 22 01:08:15 1999
+++ ./config/i370/i370.h Fri May 28 17:38:33 1999
@@ -839,7 +839,7 @@ enum reg_class
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Don't perform CSE on function addresses. */
--- ./config/i386/i386.h.jjm Fri May 28 07:33:00 1999
+++ ./config/i386/i386.h Fri May 28 17:38:51 1999
@@ -1958,7 +1958,7 @@ while (0)
/* When a prototype says `char' or `short', really pass an `int'.
(The 386 can't easily push less than an int.) */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/i860/paragon.h.jjm Mon Mar 22 01:08:14 1999
+++ ./config/i860/paragon.h Thu Jun 3 22:31:51 1999
@@ -174,12 +174,6 @@ Boston, MA 02111-1307, USA. */
*/
#define ASM_STABS_OP "//.stabs"
-/* Define this macro if an argument declared as `char' or `short' in a
- prototype should actually be passed as an `int'. In addition to
- avoiding errors in certain cases of mismatch, it also makes for
- better code on certain machines. */
-/*#define PROMOTE_PROTOTYPES*/
-
/* Define this macro if an instruction to load a value narrower
than a word from memory into a register also zero-extends the
value to the whole register. */
--- ./config/i860/i860.h.jjm Mon Mar 22 01:08:13 1999
+++ ./config/i860/i860.h Thu Jun 3 22:31:07 1999
@@ -892,6 +892,11 @@ struct cumulative_args { int ints, float
#define LITERAL_COMPARE_BETTER_UNSIGNED(intval, mode) \
(((unsigned) (intval) & 0x1f) == (unsigned) (intval))
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/i960/i960.h.jjm Thu Jun 3 22:32:15 1999
+++ ./config/i960/i960.h Thu Jun 3 22:33:13 1999
@@ -1593,6 +1593,14 @@ extern struct rtx_def *gen_compare_reg (
#define PROMOTE_PROTOTYPES TARGET_CLEAN_LINKAGE
/* ??? This does not exist. */
#define PROMOTE_RETURN TARGET_CLEAN_LINKAGE
+
+#else
+
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
#endif
/* Instruction type definitions. Used to alternate instructions types for
--- ./config/m32r/m32r.h.jjm Wed Dec 16 22:06:02 1998
+++ ./config/m32r/m32r.h Fri May 28 17:40:43 1999
@@ -810,7 +810,7 @@ M32R_STACK_ALIGN (current_function_outgo
/* Function argument passing. */
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* If defined, the maximum amount of space required for outgoing
arguments will be computed and placed into the variable
--- ./config/m68k/m68k.h.jjm Mon Mar 1 16:06:46 1999
+++ ./config/m68k/m68k.h Fri May 28 17:41:04 1999
@@ -1600,7 +1600,7 @@ __transfer_from_trampoline () \
#define STORE_FLAG_VALUE -1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/m88k/m88k.h.jjm Wed Dec 16 22:08:23 1998
+++ ./config/m88k/m88k.h Fri May 28 17:41:29 1999
@@ -1576,7 +1576,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_RE
`short' in a prototype should actually be passed as an
`int'. In addition to avoiding errors in certain cases of
mismatch, it also makes for better code on certain machines. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Define this macro if a float function always returns float
(even in traditional mode). Redefined in luna.h. */
--- ./config/mips/mips.h.jjm Fri May 28 07:33:32 1999
+++ ./config/mips/mips.h Fri May 28 17:41:49 1999
@@ -1495,7 +1495,7 @@ do { \
avoiding errors in certain cases of mismatch, it also makes for
better code on certain machines. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Define if operations between registers always perform the operation
on the full register even if a narrower mode is specified. */
--- ./config/ns32k/ns32k.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/ns32k/ns32k.h Thu Jun 3 22:28:13 1999
@@ -1363,6 +1363,11 @@ while (0)
#define STORE_FLAG_VALUE 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/pa/pa.h.jjm Fri May 28 07:33:49 1999
+++ ./config/pa/pa.h Fri May 28 17:42:10 1999
@@ -1884,7 +1884,7 @@ while (0)
#define STORE_FLAG_VALUE 1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./config/pdp11/pdp11.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/pdp11/pdp11.h Thu Jun 3 22:28:36 1999
@@ -962,6 +962,11 @@ extern int current_function_pretend_args
/* #define STORE_FLAG_VALUE 1 */
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/pyr/pyr.h.jjm Wed Dec 16 22:11:31 1998
+++ ./config/pyr/pyr.h Fri May 28 17:42:44 1999
@@ -1045,7 +1045,7 @@ extern int current_function_calls_alloca
/* #define NO_FUNCTION_CSE */
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* There are no flag store insns on a pyr. */
/* #define STORE_FLAG_VALUE */
--- ./config/romp/romp.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/romp/romp.h Thu Jun 3 22:28:53 1999
@@ -1231,6 +1231,11 @@ extern int romp_debugger_arg_correction(
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/rs6000/rs6000.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/rs6000/rs6000.h Thu Jun 3 22:29:38 1999
@@ -2239,6 +2239,11 @@ do {
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/sparc/sparc.h.jjm Fri May 28 07:34:19 1999
+++ ./config/sparc/sparc.h Fri May 28 18:33:19 1999
@@ -2686,7 +2698,7 @@ do {
#define STORE_FLAG_VALUE 1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES (TARGET_ARCH32)
/* Define this to be nonzero if shift instructions ignore all but the low-order
few bits. */
--- ./config/spur/spur.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/spur/spur.h Thu Jun 3 22:29:51 1999
@@ -775,6 +775,11 @@ extern int current_function_pretend_args
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/tahoe/tahoe.h.jjm Wed Dec 16 22:14:11 1998
+++ ./config/tahoe/tahoe.h Fri May 28 17:51:39 1999
@@ -627,7 +627,7 @@ enum reg_class {NO_REGS,GENERAL_REGS,FPP
/* pass chars as ints */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* pointers can be represented by an si mode expression */
--- ./config/vax/vax.h.jjm Thu Jun 3 22:26:24 1999
+++ ./config/vax/vax.h Thu Jun 3 22:30:10 1999
@@ -860,6 +860,11 @@ gen_rtx (PLUS, Pmode, frame, GEN_INT (12
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+/* Define this macro to non-zero if an argument declared as `char'
+ or `short' in a prototype should actually be passed as an `int'. */
+
+#define PROMOTE_PROTOTYPES 0
+
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */
--- ./config/we32k/we32k.h.jjm Wed Dec 16 22:14:35 1998
+++ ./config/we32k/we32k.h Fri May 28 17:51:57 1999
@@ -664,7 +664,7 @@ enum reg_class { NO_REGS, GENERAL_REGS,
#define STORE_FLAG_VALUE -1
/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
+#define PROMOTE_PROTOTYPES 1
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
--- ./c-decl.c.jjm Mon Apr 12 16:05:29 1999
+++ ./c-decl.c Thu Jun 3 22:06:27 1999
@@ -5603,12 +5603,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
@@ -6941,13 +6940,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",
--- ./c-typeck.c.jjm Fri May 28 07:30:14 1999
+++ ./c-typeck.c Thu Jun 3 22:05:42 1999
@@ -1765,12 +1765,11 @@ convert_arguments (typelist, values, nam
(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);
}
--- ./tm.texi.jjm Fri May 28 07:31:49 1999
+++ ./tm.texi Thu Jun 3 22:36:29 1999
@@ -2607,10 +2608,11 @@ control passing certain arguments in reg
@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.
@findex PUSH_ROUNDING
@item PUSH_ROUNDING (@var{npushed})
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.3.4 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________