From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22272 invoked by alias); 30 Jan 2013 14:48:47 -0000 Received: (qmail 22246 invoked by uid 22791); 30 Jan 2013 14:48:41 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f178.google.com (HELO mail-ie0-f178.google.com) (209.85.223.178) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jan 2013 14:48:31 +0000 Received: by mail-ie0-f178.google.com with SMTP id c13so1308050ieb.37 for ; Wed, 30 Jan 2013 06:48:31 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.170.4 with SMTP id ai4mr3577638igc.40.1359557311070; Wed, 30 Jan 2013 06:48:31 -0800 (PST) Received: by 10.64.34.172 with HTTP; Wed, 30 Jan 2013 06:48:30 -0800 (PST) In-Reply-To: References: Date: Wed, 30 Jan 2013 14:48:00 -0000 Message-ID: Subject: Re: [patch libiberty's include]: Fixes PR 39064 and partial PR 54620 From: Kai Tietz To: Ian Lance Taylor Cc: GCC Patches , Binutils , gdb Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00085.txt.bz2 2013/1/30 Ian Lance Taylor : > On Wed, Jan 30, 2013 at 2:53 AM, Kai Tietz wrote: >> >> this patch fixes for targets with sys/types.h the issue that wrong >> assumptions about pointer-sizes are used. >> Instead it uses uintptr_t/intptr_t. >> >> ChangeLog /include >> >> 2013-01-30 Kai Tietz >> >> PR other/54620 >> PR target/39064 >> * md5.h: Include sys/types.h if HAVE_SYS_TYPES_H >> is defined. >> * sha1.h: Likewise. >> >> Tested for x86_64-unknown-linux-gnu, x86_64-w64-mingw32, and >> i686-w64-mingw32. Ok for apply? >> >> Regards, >> Kai >> >> Index: md5.h >> =================================================================== >> --- md5.h (Revision 195288) >> +++ md5.h (Arbeitskopie) >> @@ -36,7 +36,7 @@ >> the resulting executable. Locally running cross-compiled executables >> is usually not possible. */ >> >> -#ifdef _LIBC >> +#if defined (_LIBC) || defined (HAVE_SYS_TYPES_H) >> # include >> typedef u_int32_t md5_uint32; >> typedef uintptr_t md5_uintptr; >> Index: sha1.h >> =================================================================== >> --- sha1.h (Revision 195288) >> +++ sha1.h (Arbeitskopie) >> @@ -35,7 +35,7 @@ >> the resulting executable. Locally running cross-compiled executables >> is usually not possible. */ >> >> -#ifdef _LIBC >> +#if defined (_LIBC) || defined (HAVE_SYS_TYPES_H) >> # include >> typedef u_int32_t sha1_uint32; >> typedef uintptr_t sha1_uintptr; > > > > This code is intended to be highly portable. I don't have a problem > with uintptr_t, but I'm not certain that on all systems > defines u_int32_t. > > Ian Yes, this is a valid point. The (u)int??_t types aren't necessarily declared by including sys/types.h. So what's about the following patch. If stdint.h header is present, then we should include it and then we can assume that the (u)int??_t types are present. Index: md5.h =================================================================== --- md5.h (Revision 195572) +++ md5.h (Arbeitskopie) @@ -36,7 +36,11 @@ the resulting executable. Locally running cross-compiled executables is usually not possible. */ -#ifdef _LIBC +#ifdef HAVE_STDINT_H +#include +#endif + +#if defined (_LIBC) || (defined (HAVE_SYS_TYPES_H) && defined (HAVE_STDINT_H)) # include typedef u_int32_t md5_uint32; typedef uintptr_t md5_uintptr; Index: sha1.h =================================================================== --- sha1.h (Revision 195572) +++ sha1.h (Arbeitskopie) @@ -35,7 +35,11 @@ the resulting executable. Locally running cross-compiled executables is usually not possible. */ -#ifdef _LIBC +#ifdef HAVE_STDINT_H +#include +#endif + +#if defined (_LIBC) || (defined (HAVE_SYS_TYPES_H) && defined (HAVE_STDINT_H)) # include typedef u_int32_t sha1_uint32; typedef uintptr_t sha1_uintptr;