This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
PROMOTE_ mess
- To: egcs at cygnus dot com
- Subject: PROMOTE_ mess
- From: Per Bothner <bothner at cygnus dot com>
- Date: Thu, 17 Sep 1998 10:03:21 -0700
It seems the various PROMOTE_ macros are defined inconsistently,
and contrary to their definition.
Many common ports (32-bit sparc, m68k, i386 except for os2) only
define PROMOTE_PROTOTYPES. But for all all these machines,
a 8- or 16-bit scalar argument needs to be widened to 32 bits
*independently* of whether there is a prototype.
Instead, they should be defining PROMOTE_FUNCTION_ARGS and
PROMOTE_FUNCTION_RETURN (and of course PROMOTE_MODE).
Depending on PROMOTE_PROTOTYPES to do the promotion makes it
the responsibility of each front-end to do the promotion.
This seems highly inappropriate, because in most cases, promotion
is specified by the ABI and target architecture, and not the
language.
This came up as an inconsistency between cc1plus and jc1, which
does not check for PROMOTE_PROTOTYPES. The easiest thing to do
would be to change jc1; still, I think the correct fix is in the
target files.
One related suggestion, so you would not have to define PROMOTE_MODE,
which is more-or-less the same on most applicable machines. In
prmote_mode, replace:
#ifdef PROMOTE_MODE
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case CHAR_TYPE: case REAL_TYPE: case OFFSET_TYPE:
PROMOTE_MODE (mode, unsignedp, type);
break;
#endif
by:
#if defined(PROMOTE_MODE) || defined(PROMOTE_FUNCTION_ARGS) \
|| defined(PROMOTE_FUNCTION_ARGS)
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case CHAR_TYPE: case REAL_TYPE: case OFFSET_TYPE:
#ifdef PROMOTE_MODE
PROMOTE_MODE (mode, unsignedp, type);
#else
if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
mode = TYPE_MODE (integer_type_node);
#endif
break;
#endif
--Per