From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99496 invoked by alias); 19 Aug 2016 23:37:37 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 99474 invoked by uid 89); 19 Aug 2016 23:37:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=our, H*F:U*pinskia X-HELO: mail-lf0-f66.google.com Received: from mail-lf0-f66.google.com (HELO mail-lf0-f66.google.com) (209.85.215.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Aug 2016 23:37:26 +0000 Received: by mail-lf0-f66.google.com with SMTP id 33so3657326lfw.3 for ; Fri, 19 Aug 2016 16:37:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/IdLNaxfulIebbvmU5OoZUVBwNtbMXyPwDfZwllyu/I=; b=K25WvUA+SyesBCznhUBmkxQ0IHa79hobil95V4S5npBibWOMiDpwThAl6HkL/wCOaI x5rHT2uxWKhnGgGJvos8EZqpKerIbvFGXQZ/yxJfZpG+xPflVBBGGyoRQORYZeTf1nYh tn5v77xpT5cikTnK4TdqM1t6N8OyI/f0wmMabzLotS0fMksiRdFCtoNcsB2olJkoxbR3 47G0IkSaKcw+3HX6HaVhDR7OnjF75H3miStX4YEjiOu7eBAAAglWhywJ4NgnWI7lDo9q MSN9RaYW7ThF43sk73rK2NBH0I1l1MwI/LpvNE6T7A6OfTXGCk0cHEJeBSC1jwtCye5B VcwA== X-Gm-Message-State: AEkoouuqzSMBTZ8RiFGNo/cP1Du0w4TDdGV+scr2VQQfq51RglBAnwSAOACMxKPohrX3Ug2OdN5fLCW1BNoxrw== X-Received: by 10.25.17.70 with SMTP id g67mr3192212lfi.145.1471649843671; Fri, 19 Aug 2016 16:37:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.42.4 with HTTP; Fri, 19 Aug 2016 16:37:22 -0700 (PDT) In-Reply-To: References: From: Andrew Pinski Date: Fri, 19 Aug 2016 23:37:00 -0000 Message-ID: Subject: Re: [PATCH] newlib-stdint.h: Remove 32 bit longs To: Andy Ross Cc: GCC Patches , "" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016/txt/msg00981.txt.bz2 On Fri, Aug 19, 2016 at 12:16 PM, Andy Ross wrote: > We ran into this issue in the Zephyr project with our toolchain (gcc > built with --enable-newlib). Basically GCC appears to be honoring a > legacy requirement to give newlib a "long" instead of "int" for > __INT32_TYPE__, which then leaks out through the current newlib > headers as a long-valued int32_t, which produces gcc warnings when a > uint32_t is passed to an unqualified printf format specifier like > "%d". > > But the newlib headers, if __INT32_TYPE__ is *not* defined by the > compiler, have code to chose a "int" over "long" immediately > thereafter. It seems whatever requirement this was honoring isn't > valid anymore. Couple of things missing here. A changelog is the first thing. The second thing is it seems like Zephyr project should be using the PRIdx, etc. instead of just %d for int32_t to be portable. Thanks, Andrew > > From 784fb1760a930d0309f878bbae7bfd38137f5689 Mon Sep 17 00:00:00 2001 > From: Andy Ross > Date: Fri, 19 Aug 2016 09:40:42 -0700 > Subject: [PATCH] newlib-stdint.h: Remove 32 bit longs > > This would make __INT32_TYPE__ a "long" instead of an "int", which > would then percolate down in newlib's own headers into a typedef for > int32_t. Which is wrong. Newlib's headers, if __INT32_TYPE__ were > not defined, actually would chose an int for this type. The comment > that newlib uses a 32 bit long appears to be a lie, perhaps > historical. > > Signed-off-by: Andy Ross > --- > gcc/config/newlib-stdint.h | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/newlib-stdint.h b/gcc/config/newlib-stdint.h > index eb99556..0275948 100644 > --- a/gcc/config/newlib-stdint.h > +++ b/gcc/config/newlib-stdint.h > @@ -22,10 +22,9 @@ a copy of the GCC Runtime Library Exception along with this program; > see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > . */ > > -/* newlib uses 32-bit long in certain cases for all non-SPU > - targets. */ > +/* newlib used to use a 32-bit long, no longer */ > #ifndef STDINT_LONG32 > -#define STDINT_LONG32 (LONG_TYPE_SIZE == 32) > +#define STDINT_LONG32 0 > #endif > > #define SIG_ATOMIC_TYPE "int" > -- > 2.7.4 >