[Bug c/108224] Suggest stdlib.h header for rand
jg at jguk dot org
gcc-bugzilla@gcc.gnu.org
Sun Dec 25 22:40:24 GMT 2022
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
More information about the Gcc-bugs
mailing list