Message ID | 881e795d-34c8-0445-74cf-cb68192d2dfe@jguk.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A0E7385840F for <patchwork@sourceware.org>; Mon, 26 Dec 2022 08:56:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 2FA103858D33 for <gcc-patches@gcc.gnu.org>; Mon, 26 Dec 2022 08:55:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2FA103858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org Received: by mail-wr1-x42d.google.com with SMTP id j17so4219107wrr.7 for <gcc-patches@gcc.gnu.org>; Mon, 26 Dec 2022 00:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ncbgEE8t6u3M9oUu/T6dNvajkn6BImXKN7Iq9bDSSXc=; b=S7SABY3P4S2/rJMaxTbU3Mt8FvzDHj3RyAzLCwzIgune3m2BJT2WDzGm15mhnthghz Wyll3PvSH0J70NFeqtQqUXWwB7CGxjXlprJVr5Dap2Wkphz48GRmW7Am7Jwk7eVIOVXz 3jZpysQUefu2cWfJJEHwr5fea6wbklb8bTkcbCzrpglNeCXXT6t5mvnHhlTkCq5nSGf1 VTSjoU4pUfIQfDWfT9W9JpZEgPGU9yW2SfsWblSX2/tAK2gHj790xtz6hJK69Lfil2td 7h9sTU2thWpcQOydWhHD6/zyIOy8UW9NB7qClR9zz29kJcaSl/AZZKkLOabqQrhHECOW d9zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ncbgEE8t6u3M9oUu/T6dNvajkn6BImXKN7Iq9bDSSXc=; b=pqfDieolltXJA6IxkOyv8Umy1/Y6BpMgXMjXxpeOEFcEzDjWXj+vbnN0kr53PdPspp 0N77LK2X6A2y/v10mZ4zNy2IfaLZ6Yik85/8ZncuMk+SpHGza21aNQdcL42NeRB72Mfi ejFckPOF3CJzlGBE6Nh1tG+1jV6XtW385G/EH/rB6P3nlgtooPodX0vGYkFcovnVBG38 B3X+uKVHHZWH4tfpy6EBUSA9is/vuUEsf4jAB0bYlHxyJWcNTQP1Ub7/07XjVC6//ceV S5u5Lu19MIXAHwYpTgxtbekXNK/nFqCtsbtunrSH6jZ4dCDVk/VotmBloB4U7/20/OT3 oGjw== X-Gm-Message-State: AFqh2krY8XQs+m8DTJr5Knz31/Ie1ut89jmYNBdHWRcWx9xXvHJiDKYH FqHYuR1VUGj0W+uHdvAR/gZ6EkpPbiNQY3aG X-Google-Smtp-Source: AMrXdXuDkz1SG2M79eF2tlauj26/VzTbkeyubw/x8/7Un7A4zgEpD0G/i0pGAxB/25MPDHb8Wavmuw== X-Received: by 2002:adf:e5cd:0:b0:241:fd48:dccd with SMTP id a13-20020adfe5cd000000b00241fd48dccdmr10514135wrn.63.1672044946638; Mon, 26 Dec 2022 00:55:46 -0800 (PST) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id p11-20020adfe60b000000b002366e3f1497sm10107455wrm.6.2022.12.26.00.55.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Dec 2022 00:55:46 -0800 (PST) Message-ID: <881e795d-34c8-0445-74cf-cb68192d2dfe@jguk.org> Date: Mon, 26 Dec 2022 08:55:45 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-GB To: gcc-patches@gcc.gnu.org From: Jonny Grant <jg@jguk.org> Subject: [Bug c/108224] [PATCH] add srandom random initstate setstate Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[Bug,c/108224] add srandom random initstate setstate
|
|
Commit Message
Jonny Grant
Dec. 26, 2022, 8:55 a.m. UTC
From 6ff344979af46dbcd739dd9068d6d595547e4c27 Mon Sep 17 00:00:00 2001
From: Jonathan Grant <jg@jguk.org>
Date: Sun, 25 Dec 2022 22:38:44 +0000
Subject: [PATCH] add srandom random initstate setstate
---
gcc/c-family/known-headers.cc | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Mon, 26 Dec 2022 at 14:25, Jonny Grant <jg@jguk.org> wrote: > > > > From 6ff344979af46dbcd739dd9068d6d595547e4c27 Mon Sep 17 00:00:00 2001 > From: Jonathan Grant <jg@jguk.org> > Date: Sun, 25 Dec 2022 22:38:44 +0000 > Subject: [PATCH] add srandom random initstate setstate > > --- > gcc/c-family/known-headers.cc | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc > index 9c256173b82..ade9fa2dcc0 100644 > --- a/gcc/c-family/known-headers.cc > +++ b/gcc/c-family/known-headers.cc > @@ -171,6 +171,10 @@ get_stdlib_header_for_name (const char *name, enum stdlib lib) > {"getenv", {"<stdlib.h>", "<cstdlib>"} }, > {"malloc", {"<stdlib.h>", "<cstdlib>"} }, > {"realloc", {"<stdlib.h>", "<cstdlib>"} }, > + {"random", {"<stdlib.h>", "<cstdlib>"} }, > + {"srandom", {"<stdlib.h>", "<cstdlib>"} }, > + {"initstate", {"<stdlib.h>", "<cstdlib>"} }, > + {"setstate", {"<stdlib.h>", "<cstdlib>"} }, > > /* <string.h> and <cstring>. */ > {"memchr", {"<string.h>", "<cstring>"} }, Hi Jonny, Thanks for the patch. A couple of things: (a) Could you please add a test-case for the above symbols ? See testsuite/gcc.dg/missing-header-fixit-4.c for a similar example for printf. (b) The patch is missing changelog. I assume you've tested the patch with bootstrap+regtest ? Thanks, Prathamesh > -- > 2.37.2
On 26/12/2022 09:19, Prathamesh Kulkarni wrote: > On Mon, 26 Dec 2022 at 14:25, Jonny Grant <jg@jguk.org> wrote: >> >> >> >> From 6ff344979af46dbcd739dd9068d6d595547e4c27 Mon Sep 17 00:00:00 2001 >> From: Jonathan Grant <jg@jguk.org> >> Date: Sun, 25 Dec 2022 22:38:44 +0000 >> Subject: [PATCH] add srandom random initstate setstate >> >> --- >> gcc/c-family/known-headers.cc | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc >> index 9c256173b82..ade9fa2dcc0 100644 >> --- a/gcc/c-family/known-headers.cc >> +++ b/gcc/c-family/known-headers.cc >> @@ -171,6 +171,10 @@ get_stdlib_header_for_name (const char *name, enum stdlib lib) >> {"getenv", {"<stdlib.h>", "<cstdlib>"} }, >> {"malloc", {"<stdlib.h>", "<cstdlib>"} }, >> {"realloc", {"<stdlib.h>", "<cstdlib>"} }, >> + {"random", {"<stdlib.h>", "<cstdlib>"} }, >> + {"srandom", {"<stdlib.h>", "<cstdlib>"} }, >> + {"initstate", {"<stdlib.h>", "<cstdlib>"} }, >> + {"setstate", {"<stdlib.h>", "<cstdlib>"} }, >> >> /* <string.h> and <cstring>. */ >> {"memchr", {"<string.h>", "<cstring>"} }, > Hi Jonny, > Thanks for the patch. A couple of things: > (a) Could you please add a test-case for the above symbols ? See > testsuite/gcc.dg/missing-header-fixit-4.c > for a similar example for printf. > (b) The patch is missing changelog. > I assume you've tested the patch with bootstrap+regtest ? Hi Prathmesh Many thanks for your reply. I built gcc by typing "make", I understand that is the bootstrap. I don't know about regtest, could you direct me to a guide please. I didn't add a test; I can do that now. Is there an FAQ you can direct me to to run those tests please. Running ‘make check-c’ now, its taking along time on gcc.c-torture. Is there a way I can quickly run only the gcc.dg missing header tests? BTW, do you know if a change could be made to detect dejagnu being installed? Would be good if "make check" quickly failed if the "runtest" command from dejagnu was not found. I needed to install these two packages. Would be good to get a hint when running ‘make check-c’ autogen dejagnu For the files like missing-header-fixit-4.c is it sufficient to just add a file to that folder? Cheers Jonny
On Wed, 28 Dec 2022 at 04:01, Jonny Grant <jg@jguk.org> wrote: > > > > On 26/12/2022 09:19, Prathamesh Kulkarni wrote: > > On Mon, 26 Dec 2022 at 14:25, Jonny Grant <jg@jguk.org> wrote: > >> > >> > >> > >> From 6ff344979af46dbcd739dd9068d6d595547e4c27 Mon Sep 17 00:00:00 2001 > >> From: Jonathan Grant <jg@jguk.org> > >> Date: Sun, 25 Dec 2022 22:38:44 +0000 > >> Subject: [PATCH] add srandom random initstate setstate > >> > >> --- > >> gcc/c-family/known-headers.cc | 4 ++++ > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc > >> index 9c256173b82..ade9fa2dcc0 100644 > >> --- a/gcc/c-family/known-headers.cc > >> +++ b/gcc/c-family/known-headers.cc > >> @@ -171,6 +171,10 @@ get_stdlib_header_for_name (const char *name, enum stdlib lib) > >> {"getenv", {"<stdlib.h>", "<cstdlib>"} }, > >> {"malloc", {"<stdlib.h>", "<cstdlib>"} }, > >> {"realloc", {"<stdlib.h>", "<cstdlib>"} }, > >> + {"random", {"<stdlib.h>", "<cstdlib>"} }, > >> + {"srandom", {"<stdlib.h>", "<cstdlib>"} }, > >> + {"initstate", {"<stdlib.h>", "<cstdlib>"} }, > >> + {"setstate", {"<stdlib.h>", "<cstdlib>"} }, > >> > >> /* <string.h> and <cstring>. */ > >> {"memchr", {"<string.h>", "<cstring>"} }, > > Hi Jonny, > > Thanks for the patch. A couple of things: > > (a) Could you please add a test-case for the above symbols ? See > > testsuite/gcc.dg/missing-header-fixit-4.c > > for a similar example for printf. > > (b) The patch is missing changelog. > > I assume you've tested the patch with bootstrap+regtest ? > > Hi Prathmesh > Many thanks for your reply. > > I built gcc by typing "make", I understand that is the bootstrap. I don't know about regtest, could you direct me to a guide please. Hi, Sorry for slow response. It depends on how you configured gcc. If bootstrap is enabled (which is by default), then make would bootstrap gcc. Typically for development, we disable bootstrap by passing --disable-bootstrap to configure for faster builds, and then validate the patch with final bootstrap+test. For regression testing, you'd have to (1) Bootstrap the trunk without the patch, (2) Bootstrap the trunk with patch, (3) Compare the two build dirs with $gcc-src/contrib/compare_tests. and address issues for the FAIL'd tests. > > I didn't add a test; I can do that now. Is there an FAQ you can direct me to to run those tests please. > > Running ‘make check-c’ now, its taking along time on gcc.c-torture. > Is there a way I can quickly run only the gcc.dg missing header tests? > > BTW, do you know if a change could be made to detect dejagnu being installed? > > Would be good if "make check" quickly failed if the "runtest" command from dejagnu was not found. > > I needed to install these two packages. Would be good to get a hint when running ‘make check-c’ > autogen dejagnu > > > For the files like missing-header-fixit-4.c is it sufficient to just add a file to that folder? Yes, adding the file in $gcc-src/gcc/testsuite/gcc.dg/ should be sufficient. For eg, to only run missing-header-fixit-4.c this should work: make check-gcc RUNTESTFLAGS="dg.exp=missing-header-fixit-4.c" Thanks, Prathamesh > Cheers > Jonny
diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc index 9c256173b82..ade9fa2dcc0 100644 --- a/gcc/c-family/known-headers.cc +++ b/gcc/c-family/known-headers.cc @@ -171,6 +171,10 @@ get_stdlib_header_for_name (const char *name, enum stdlib lib) {"getenv", {"<stdlib.h>", "<cstdlib>"} }, {"malloc", {"<stdlib.h>", "<cstdlib>"} }, {"realloc", {"<stdlib.h>", "<cstdlib>"} }, + {"random", {"<stdlib.h>", "<cstdlib>"} }, + {"srandom", {"<stdlib.h>", "<cstdlib>"} }, + {"initstate", {"<stdlib.h>", "<cstdlib>"} }, + {"setstate", {"<stdlib.h>", "<cstdlib>"} }, /* <string.h> and <cstring>. */ {"memchr", {"<string.h>", "<cstring>"} },