From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by sourceware.org (Postfix) with ESMTPS id 007DF3858C60 for ; Fri, 27 Aug 2021 16:17:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 007DF3858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f50.google.com with SMTP id b4so15383056lfo.13 for ; Fri, 27 Aug 2021 09:17:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=J6msFK1xia959N6lTR0/xYMF19v92D2pMoqK5U0YPFU=; b=QDBRDereuRP9r1d6TxCtgYgrgavgdL1eM506TJG0t8KPty3iHnHizpo/Ng/zv6IvAB pwUzyyoxoTnyVtzwGFM+PJjn6oWRNdPS4hTIZlRK7lHc8ubcC05E/yCOdCgoBK01B0gr tvLT8b3gX1K6C8wJdbsIkGCxvs4Y6BdAIGGhACHwbWBdCG34HWHw1CSgKTVLNirJXDZI tLyGlInY54sPTIeKvgr+hXPoeVj1SE5xl+6wEnOsoEX0m5iaVd05BM2dqV6fLYoA9QIC CmQXk5WMdPB2NJRt+4UFTkj08J7wuRiC1zpujoy1IQsMTGYMdWjmLZ2794OSuGRNMuu3 4PQQ== X-Gm-Message-State: AOAM5300Qafm38dveFNrPEClejVrI3sfMQMVC07Ga5fkvw+Fm0133Rs/ /yHCEfimRGt6RY7Yqk0vAO667ZyLqbwrlQ== X-Google-Smtp-Source: ABdhPJwNmWbWVfFPF7UsoNa7AQ6GM5oeNQvL25AFX6P9hTqvBvwwaSwnJmPYWDMpJ3ErEjndIqTjVA== X-Received: by 2002:a05:6512:3b11:: with SMTP id f17mr7119587lfv.169.1630081029570; Fri, 27 Aug 2021 09:17:09 -0700 (PDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id a22sm210483lfb.17.2021.08.27.09.17.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Aug 2021 09:17:09 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id m18so1306420lfl.10 for ; Fri, 27 Aug 2021 09:17:08 -0700 (PDT) X-Received: by 2002:a05:6512:12c8:: with SMTP id p8mr3699405lfg.208.1630081028794; Fri, 27 Aug 2021 09:17:08 -0700 (PDT) MIME-Version: 1.0 References: <20210825191245.30049-1-joel@rtems.org> In-Reply-To: Reply-To: joel@rtems.org From: Joel Sherrill Date: Fri, 27 Aug 2021 11:16:56 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h To: C Howland Cc: Newlib X-Spam-Status: No, score=-3031.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2021 16:17:13 -0000 On Fri, Aug 27, 2021, 10:12 AM C Howland wrote: > > > > > > ------------------------------ > > *From:* Newlib on > > behalf of Joel Sherrill > > *Sent:* Friday, August 27, 2021 9:47 AM > > *To:* Newlib > > *Subject:* Re: Fw: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h > > > > > > On Fri, Aug 27, 2021 at 5:16 AM Corinna Vinschen > > wrote: > > > > > > On Aug 26 18:28, Joel Sherrill wrote: > > > > We recently added this to sys/signal.h: > > > > > > > > #if __STDINT_EXP(INT_MAX) > 0x7fff > > > > #define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1) > > > > #else > > > > #define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("65535") - 1) > > > > #endif > > > > > > > > And -ffreestanding breaks that. I see two solutions: > > > > > > > > (1) Add __STDINT_EXP to gcc's stdint-gcc.h > > > > (2) Switch that #if to something else > > > > > > > > I think something like this is an OK substitute works equivalently: > > > > > > > > #if __SIZEOF_INT__ > 2 > > > > > > or even __SIZEOF_INT__ >= 4 to be extra *extra* paranoid, but yeah, > > > sure, go ahead. The commmit message should just briefly explain the > > > freestanding implementation issue. > > > > Patch posted. Hopefully the commit message is clear enough. > > > > This one definitely is in the land of subtle small things. > > > > Thanks for the feedback and push to look for a deeper explanation. > > > > --joel > > > > > > > > Corinna > > > > Just to close out the details on this more-esoteric subject: > -ffreestanding is improper for using Newlib, so we don't need to account > for it in general. (A freestanding implementation may only use a subset of > the library, and stdint.h is not one of that list--which in C11 is > , , , , , , > , ,and .) You have stdint.h in the allowed list. :) So the original is fine, but > so is the tweak. > Better to avoid any dependency on something newlib specific in favor of something gcc provides. FWIW the freestanding option is used to compile the FreeBSD kernel code RTEMS uses for tcpip, USB, etc. We are currently using about 4000 files from them between the kernel and commands. I don't know the origin of using that compile option but do know the FreeBSD kernel is guilty of using names like malloc with different signatures. --joel Craig >