From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id BCD45385783E for ; Fri, 23 Jul 2021 05:44:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCD45385783E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-x231.google.com with SMTP id a19so721192oiw.6 for ; Thu, 22 Jul 2021 22:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=/YYMiNkzpsvPh1WyUDkSOpA8j5+M5cgBx5uNpj1YPno=; b=S3DXK8YK188ZxGK9HSH6vtfPbvFYI3QJrUEYLn53BZfVg46/3XA80wMPWatTNrFoXc qoEj+Qld5FtHPs+2AvpeDc2q9rsaC4y/EFvWTRcodpK95j/0ist2cDLD1XjgOqxEuoLO Z8qWxcqJZOFi7orJwAw6aIs1Dplsg2XW1pl/pYGOnMUbtRlnaL+NWEP5qRRvA2wd16om 2ai47IB/p2nKIkYz0B2nR5/ly4cotKrLRHLQAoLzNG4PSmrYYWPqj9IewIjAyPdg1A+5 bhfmkVZgqbEQY1NM9HmSjIu8Co7aYEXeCgzwgGndshA3h4T+lFylshSN4rCo8C4/uNJ6 +Hbg== 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:from:date :message-id:subject:to; bh=/YYMiNkzpsvPh1WyUDkSOpA8j5+M5cgBx5uNpj1YPno=; b=JjLjqeD0dtBh117QcGlpRdhVi4pieavgFZ4JdnD7+Qn0ohA8y9JRqbIfnc3MyQLHmo /2Qg2DbrshudMMq7SlV1/0uns5cP4GEbVKRutxfrXY+BDWAdWfZlCGq1LpSV1KKTrn7E ViwL6HKCrWfltUDsma/F14MDQQLlJS7j4KDzKm79IM6sJ/9OxHnQWWtM4V5+TMsDgA7v +4aQSpqZpYjGDqCk9m8zQQczreJrtVpW68txPCxt0zl/DK3ARgSfxg7IMlU16PfGJ8sR PxkxBbadZsmsV5ZTtqrFiUwF+rA69C6/V8Bq35olL2ydwEloCv14sClaYTm5qvKLjo7q d2hg== X-Gm-Message-State: AOAM530DicCFrdummdrM1BdIBTPm1ZOwTyeOKoe/RUJWZ78DHW9Jlq8m W5dGbO579mR5VlFAw+k60ya1FBd4UhPn+GekapHo0zZGeQ== X-Google-Smtp-Source: ABdhPJxwX0EvJRb2I2d0rArgAmjK/LUy33nSTpCsu1cOCETu/HUDwSsq8RVVKJ2JlZ1H8Jm78aG/Y9N+7eAscsPBdqw= X-Received: by 2002:aca:ab16:: with SMTP id u22mr7794912oie.177.1627019052810; Thu, 22 Jul 2021 22:44:12 -0700 (PDT) MIME-Version: 1.0 References: <20210717101038.3283-1-mfjoyce2004@gmail.com> <20210717101038.3283-2-mfjoyce2004@gmail.com> In-Reply-To: From: Matthew Joyce Date: Fri, 23 Jul 2021 07:44:01 +0200 Message-ID: Subject: Re: [PATCH 1/1] libc: Added implementations and prototypes for To: Newlib , Matthew Joyce , Joel Sherrill Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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, 23 Jul 2021 05:44:16 -0000 Hi Corinna, Thanks again for the explanation! I think I had just failed to include stdint.h. Now that it's working, I'd like to clarify: If SIG2STR_MAX is now 17, this will impact the message "Unknown signal " in case the signum isn't a valid, recognized signal number. Is it better to change the error message (by taking out the part) or make SIG2STR_MAX larger? Thank you! Sincerely, Matt On Thu, Jul 22, 2021 at 9:55 AM Corinna Vinschen wrote: > > Hi Matt, > > On Jul 22 07:14, Matthew Joyce wrote: > > Hi Corinna, > > > > I've made the changes you recommended but I'm running into a problem > > with the definition of SIG2STR_MAX. You suggested: > > > > #if __STDINT_EXP(INT_MAX) > 0x7fff > > #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("4294967295") - 1) > > #else #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("65535") - 1) > > These are actually two lines, right? It's just a copy/paste glitch, > I guess. > > > #endif > > > > I've tried it both in newlib and natively but I get the error: > > " missing binary operator before token '(' " > > (In the first line of the block) > > I hacked a STC: > > ---------------------------------- > #include > #include > #include > > #if __STDINT_EXP(INT_MAX) > 0x7fff > #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("4294967295") - 1) > #else > #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("65535") - 1) > #endif > > void > foo (int sig, char *out) > { > char buf[SIG2STR_MAX]; > > if (sig > SIG2STR_MAX) > return; > snprintf (buf, SIG2STR_MAX, "FOO+%d", sig); > memcpy (out, buf, SIG2STR_MAX); > } > ---------------------------------- > > $ gcc -g -O2 -c -Wall foo.c > > No error or warning is generated, so I'm puzzled about your problem. > > Would you mind to paste the affected code snippet and the full gcc error > output? > > > Corinna >