public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jg at jguk dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/108224] Suggest stdlib.h header for rand
Date: Sun, 25 Dec 2022 22:40:24 +0000	[thread overview]
Message-ID: <bug-108224-4-XOEYfv6byn@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108224-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108224

--- Comment #3 from Jonny Grant <jg at jguk dot org> ---
Great! I just saw it is the same for random(), srandom(), initstate(),
setstate()

Is there an easy way to add them all based on the C API to save opening
separate tickets?

I added those :

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>"} },
-- 
2.37.2

  parent reply	other threads:[~2022-12-25 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 22:04 [Bug c/108224] New: " jg at jguk dot org
2022-12-25 22:09 ` [Bug c/108224] " pinskia at gcc dot gnu.org
2022-12-25 22:11 ` pinskia at gcc dot gnu.org
2022-12-25 22:15 ` pinskia at gcc dot gnu.org
2022-12-25 22:40 ` jg at jguk dot org [this message]
2022-12-26  6:54 ` sam at gentoo dot org
2022-12-26  8:59 ` jg at jguk dot org
2023-12-01  8:44 ` sjames at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108224-4-XOEYfv6byn@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).