From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by sourceware.org (Postfix) with ESMTPS id F0965382CC3E for ; Mon, 2 Aug 2021 14:20:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F0965382CC3E 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-lj1-f180.google.com with SMTP id u20so24183330ljo.0 for ; Mon, 02 Aug 2021 07:20:56 -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=KaBynKvhitfYoA9EmZ0CUfrIl5eEGrNsGQLhUmh0HhQ=; b=C8OC6Rx3FPNVk9eWomu0mH0CaLwfGkAB99gF2/R4r9e4SYQn31x4oUxzVCBPT89bnh j4fJ8gEFSfWeEGKGFXi6Tm//P1dSyo9WAZtXkeHXn5nr13E8c/rB7dVuk0d/aegp79Un UXukByzb/PL8qBAhJDaJZRPRBSIu8Oj8b4FCBKCryqtSOcyggnvlDzdb9q1lU12sVaQJ pbEvsjjj7ctx85Sw4hbGW/mYEx90v7I5aV4mQCfz2SpnBMn0Is6LE/pVGs3Jnoilodc1 y+uKYZFBmtz51dGheJKcACjUeW9d/htTKCTf7vk1n/sJHBukM3ffBHmZXq7K1AcuI0wT E4TQ== X-Gm-Message-State: AOAM5323D/KI1pDqXJ9RdgzVbrY8/GU0O2cy4UBss+bvWw6eHCGlWmYE iMzFl1vx2KQfNh9/LyOlF71+Ypq3wP4SgA== X-Google-Smtp-Source: ABdhPJyt8D9ARZXrAv4isbQTpwUjnblbcTtzOZlc3tNdVzeVa6VeV5MCQUUfixt9B7rSGM4u3LfxaA== X-Received: by 2002:a2e:8887:: with SMTP id k7mr11336445lji.226.1627914055332; Mon, 02 Aug 2021 07:20:55 -0700 (PDT) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id e8sm691544lfs.277.2021.08.02.07.20.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Aug 2021 07:20:55 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id h2so34035523lfu.4 for ; Mon, 02 Aug 2021 07:20:54 -0700 (PDT) X-Received: by 2002:ac2:532d:: with SMTP id f13mr12853053lfh.123.1627914054610; Mon, 02 Aug 2021 07:20:54 -0700 (PDT) MIME-Version: 1.0 References: <20210802140058.3885657-1-cmuellner@gcc.gnu.org> In-Reply-To: <20210802140058.3885657-1-cmuellner@gcc.gnu.org> Reply-To: joel@rtems.org From: Joel Sherrill Date: Mon, 2 Aug 2021 09:20:43 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] libc: Fix compilation for new sig2str/str2sig implementation To: Christoph Muellner Cc: Newlib , Kito Cheng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1021.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable 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: Mon, 02 Aug 2021 14:20:58 -0000 I'm ok with this. We discussed this as needed during the patch review but it must have slipped through the cracks while we were discussing the guards for the method prototype. On Mon, Aug 2, 2021 at 9:01 AM Christoph Muellner wrote: > > A recent patch introduced new code for sig2str/str2sig. > This code does not properly exclude code that requires > SIGRTMIN/SIGRTMAX to be defined and triggers the following > compile error: > > newlib/libc/signal/sig2str.c:199:8: error: 'SIGRTMIN' undeclared > newlib/libc/signal/sig2str.c:200:29: error: 'SIGRTMAX' undeclared > > Let's add the missing guards. > > Fixes: 2b50ec0cd205 ("libc: Fix compilation for new sig2str/str2sig implementation") > > Signed-off-by: Christoph Muellner > --- > newlib/libc/signal/sig2str.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/newlib/libc/signal/sig2str.c b/newlib/libc/signal/sig2str.c > index 940a5eab9..d3be1ba68 100644 > --- a/newlib/libc/signal/sig2str.c > +++ b/newlib/libc/signal/sig2str.c > @@ -194,6 +194,7 @@ sig2str(int signum, char *str) > { > const sig_name_and_num *sptr; > > +#if defined (SIGRTMIN) && defined (SIGRTMAX) > /* If signum falls in lower half of the real time signals range, define > * the saved str value as "RTMIN+n" according to the Issue 8 standard */ > if ((SIGRTMIN + 1) <= signum && > @@ -209,6 +210,7 @@ sig2str(int signum, char *str) > sprintf(str, "RTMAX-%d", (SIGRTMAX - signum)); > return 0; > } > +#endif > > /* Otherwise, search for signal matching signum in sig_array. If found, > * save its string value in str. */ > @@ -231,6 +233,7 @@ str2sig(const char *restrict str, int *restrict pnum) > const sig_name_and_num *sptr; > unsigned long is_valid_decimal; > > +#if defined (SIGRTMIN) && defined (SIGRTMAX) > /* i686 Cygwin only supports one RT signal. For this case, skip checks > * for "RTMIN+n" and "RTMAX-m". */ > if (SIGRTMIN != SIGRTMAX) { > @@ -269,6 +272,7 @@ str2sig(const char *restrict str, int *restrict pnum) > return -1; > } > } > +#endif > > /*If str is a valid signal name, save its corresponding number in pnum. */ > for (sptr = sig_array; sptr < &sig_array[NUM_OF_SIGS]; sptr++) { > @@ -289,9 +293,10 @@ str2sig(const char *restrict str, int *restrict pnum) > /* If str is a representation of a decimal value, save its integer value > * in pnum. */ > if (1 <= is_valid_decimal && > - is_valid_decimal <= SIGRTMAX) { > + is_valid_decimal <= (NSIG - 1)) { > *pnum = is_valid_decimal; > return 0; > } > + > return -1; > } > -- > 2.31.1 >