From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9600 invoked by alias); 4 Sep 2009 13:27:30 -0000 Received: (qmail 9590 invoked by uid 22791); 4 Sep 2009 13:27:29 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Sep 2009 13:27:21 +0000 Received: by fg-out-1718.google.com with SMTP id 16so114998fgg.8 for ; Fri, 04 Sep 2009 06:27:18 -0700 (PDT) Received: by 10.86.227.27 with SMTP id z27mr4959394fgg.66.1252070838256; Fri, 04 Sep 2009 06:27:18 -0700 (PDT) Received: from yakj.usersys.redhat.com (nat-pool-brq.redhat.com [62.40.79.66]) by mx.google.com with ESMTPS id l12sm2156258fgb.5.2009.09.04.06.27.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Sep 2009 06:27:17 -0700 (PDT) Message-ID: <4AA115B3.2060604@gnu.org> Date: Fri, 04 Sep 2009 13:27:00 -0000 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 MIME-Version: 1.0 To: Tobias Burnus CC: Kai Tietz , gcc patches , Richard Guenther , Richard Henderson , Ralf Wildenhues Subject: Re: [patch]: Add check for stdint header References: <4AA10C84.9010309@net-b.de> <90baa01f0909040552v1b27414bo37a7e60ad0438b5b@mail.gmail.com> <4AA11386.2000007@net-b.de> In-Reply-To: <4AA11386.2000007@net-b.de> Content-Type: multipart/mixed; boundary="------------010800050000080703060801" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00358.txt.bz2 This is a multi-part message in MIME format. --------------010800050000080703060801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1748 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 --------------010800050000080703060801 Content-Type: text/plain; name="stdint.m4" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stdint.m4" Content-length: 2591 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 #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_INTTYPES_H #include #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 < #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif EOF if test "$ac_cv_type_int_least32_t" != yes; then sed 's/^ *//' >> tmp-stdint.h < 1. dnl Fix when strange machines are reported. sed 's/^ *//' >> tmp-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" ]) ]) --------------010800050000080703060801--