From: Paolo Bonzini <bonzini@gnu.org>
To: Tobias Burnus <burnus@net-b.de>
Cc: Kai Tietz <ktietz70@googlemail.com>,
gcc patches <gcc-patches@gcc.gnu.org>,
Richard Guenther <rguenther@suse.de>,
Richard Henderson <rth@redhat.com>,
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Subject: Re: [patch]: Add check for stdint header
Date: Fri, 04 Sep 2009 13:27:00 -0000 [thread overview]
Message-ID: <4AA115B3.2060604@gnu.org> (raw)
In-Reply-To: <4AA11386.2000007@net-b.de>
[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]
On 09/04/2009 03:17 PM, Tobias Burnus wrote:
> On 09/04/2009 02:52 PM, Kai Tietz wrote:
>> Well, I bootstrapped this with Paolo's stdint.m4 patch, and it
>> workedon linux32 and linux64 (i386), and for x86_64-pc-mingw32, too.
>> Just out of curiosity, who is the size in gfortran frontend for
>> int_{least,fast}*_t done, as for gcc until now no stdint.h/inttypes.h
>> file was used?
>
> Actually, I do not know how exactly it works ... I now checked - and
> here is how it works:
>
> In gcc/fortran/ one calls:
> TYPE_PRECISION (type)
> for INT_FAST64_TYPE etc. The defaults are set in
> gcc/default.h
>
> For instance:
> #ifndef INT_FAST64_TYPE
> #define INT_FAST64_TYPE ((const char *) NULL)
> #endif
>
> And the INT_*_TYPE definitions can seemingly found in
> config/*/*stdint.h. For instance:
> ./i386/cygwin-stdint.h:#define INT_FAST64_TYPE "long long int"
> ./i386/mingw-stdint.h:#define INT_FAST64_TYPE "long long int"
> ./glibc-stdint.h:#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long
> int" : "long long int")
>
> Thus, stdint.h is not directly involved and the patch should have no
> (adverse) effect on gfortran's c_int_fast*_t support.
Yes, the stdint.h we're talking about is for the host. libgfortran
(where the GCC target is actually the host, as in all target libraries)
does not use int_fast and int_least. Only the front-end itself cares,
but it uses info from the target configuration headers.
Actually I'm pretty sure that stdint.h is not needed in the GCC tree
only the intNN_t types (managed by GCC_STDINT_TYPES. But since
GCC_HEADER_STDINT is used by bfd too and I didn't want Kai to mess up
with bfd, I provided it in my stdint.m4 rewrite.
Here is the latest and greatest version.
Paolo
[-- Attachment #2: stdint.m4 --]
[-- Type: text/plain, Size: 2591 bytes --]
AC_DEFUN([GCC_STDINT_TYPES],
[AC_REQUIRE([AC_TYPE_INT8_T])
AC_REQUIRE([AC_TYPE_INT16_T])
AC_REQUIRE([AC_TYPE_INT32_T])
AC_REQUIRE([AC_TYPE_INT64_T])
AC_REQUIRE([AC_TYPE_INTMAX_T])
AC_REQUIRE([AC_TYPE_INTPTR_T])
AC_REQUIRE([AC_TYPE_UINT8_T])
AC_REQUIRE([AC_TYPE_UINT16_T])
AC_REQUIRE([AC_TYPE_UINT32_T])
AC_REQUIRE([AC_TYPE_UINT64_T])
AC_REQUIRE([AC_TYPE_UINTMAX_T])
AC_REQUIRE([AC_TYPE_UINTPTR_T])])
AC_DEFUN([GCC_HEADER_STDINT],
[AC_REQUIRE([GCC_STDINT_TYPES])
AC_CHECK_TYPES([int_least32_t, int_fast32_t],,,[#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif])
# ----------------- Summarize what we found so far
m4_define([_GCC_STDINT_H], m4_ifval($1, $1, _stdint.h))
m4_if(m4_bmatch(m4_quote(/_GCC_STDINT_H),
/stdint\.h$, bad,
/inttypes\.h$, bad, ok), bad,
[m4_fatal([cannot overwrite ]m4_quote(_GCC_STDINT_H))])
# ----------------- done all checks, emit header -------------
AC_CONFIG_COMMANDS(_GCC_STDINT_H, [
cat >> tmp-stdint.h <<EOF
#ifndef GCC_GENERATED_STDINT_H
#define GCC_GENERATED_STDINT_H 1
#include "config.h"
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
EOF
if test "$ac_cv_type_int_least32_t" != yes; then
sed 's/^ *//' >> tmp-stdint.h <<EOF
/* Define int_least types */
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
EOF
fi
if test "$ac_cv_type_int_fast32_t" != yes; then
dnl NOTE: The following code assumes that sizeof (int) > 1.
dnl Fix when strange machines are reported.
sed 's/^ *//' >> tmp-stdint.h <<EOF
/* Define int_fast types. short is often slow */
typedef int8_t int_fast8_t;
typedef int int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
EOF
fi
echo '#endif /* GCC_GENERATED_STDINT_H */' >> tmp-stdint.h
if test -r ]_GCC_STDINT_H[ && cmp -s tmp-stdint.h ]_GCC_STDINT_H[; then
rm -f tmp-stdint.h
else
mv -f tmp-stdint.h ]_GCC_STDINT_H[
fi
], [
ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
])
])
next prev parent reply other threads:[~2009-09-04 13:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 12:48 Tobias Burnus
2009-09-04 12:53 ` Kai Tietz
2009-09-04 13:18 ` Tobias Burnus
2009-09-04 13:27 ` Paolo Bonzini [this message]
2009-09-04 14:07 ` Kai Tietz
2009-09-05 12:41 ` Paolo Bonzini
2009-09-08 15:22 ` Kai Tietz
2009-09-06 10:00 ` Ralf Wildenhues
2009-09-07 6:51 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2009-09-04 13:07 Tobias Burnus
2009-09-04 13:18 ` Kai Tietz
2009-09-02 22:18 Kai Tietz
2009-09-03 1:37 ` Kai Tietz
2009-09-03 10:55 ` Richard Guenther
2009-09-03 11:05 ` Kai Tietz
2009-09-03 11:10 ` Richard Guenther
2009-09-04 7:49 ` Kai Tietz
2009-09-04 9:57 ` Richard Guenther
2009-09-04 10:36 ` Paolo Bonzini
[not found] ` <4AA0EE5E.80204@gnu.org>
[not found] ` <90baa01f0909040359r45b5b0c1gfb9132cf800bde9b@mail.gmail.com>
[not found] ` <90baa01f0909040534g4ac57551se2e843b861c42a06@mail.gmail.com>
2009-09-04 13:22 ` Paolo Bonzini
2009-09-06 9:57 ` Ralf Wildenhues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AA115B3.2060604@gnu.org \
--to=bonzini@gnu.org \
--cc=Ralf.Wildenhues@gmx.de \
--cc=burnus@net-b.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=ktietz70@googlemail.com \
--cc=rguenther@suse.de \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).