This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: adding knowledge of the int_fastN_t types to the compiler
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Wed, 12 Mar 2008 18:19:43 +0000 (UTC)
- Subject: Re: RFC: adding knowledge of the int_fastN_t types to the compiler
- References: <509B8F17-6F94-4523-8001-DFD7DD92FC15@gmail.com>
On Wed, 12 Mar 2008, FX Coudert wrote:
> I propose we implement target macros INT_FAST8_TYPE_SIZE (and so on for 16, 32
> and 64): they would be defined to -1 in defaults.h (meaning that int_fastN_t
> types are not available), and independent targets can redefine them.
> Front-ends and the middle-end can then use it if they feel like it. Attached
> is a patch implementing this idea, including target definitions for linux,
> darwin, mingw, AIX, IRIX, OpenBSD, Solaris 2.10.
TARGET_64BIT is not a constant but depends on command-line options and
will not be defined at all for some GNU/Linux targets, so your Linux
definition is incorrect. I suggest runtime-variable values depending on a
target-independent macro such as LONG_TYPE_SIZE. Also remember the
various GNU/Linux targets that do not use config/linux.h (alpha, rs6000,
sparc).
Note that the size is not enough for implementing <stdint.h>, you need the
actual type as well to get C++ mangling right. So I suggest using
type-name strings as is done for the other standard typedefs, rather than
having these macros different from all the others, even if at first you do
not define all the information needed for all the other <stdint.h> types
and so do not implement <stdint.h> itself.
--
Joseph S. Myers
joseph@codesourcery.com