summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2023-04-21 11:22:52 +0200
committerGitHub <noreply@github.com>2023-04-21 11:22:52 +0200
commit518e6912cac994f81a99e978f4dfed7dfb087aaa (patch)
treed6943d8499c4d21efa100c99cf9cee2211a637dc
parentc33fd13ceebbefa6026468e2f0e07608a8cd1a88 (diff)
downloadocaml-518e6912cac994f81a99e978f4dfed7dfb087aaa.tar.gz
Don't include stdbool.h systematically (#12196)
It can cause problem with user code that defines its own `bool` type. Instead, use stdbool.h internally only, and only when really needed.
-rw-r--r--runtime/caml/config.h1
-rw-r--r--runtime/caml/frame_descriptors.h1
-rw-r--r--runtime/weak.c2
3 files changed, 2 insertions, 2 deletions
diff --git a/runtime/caml/config.h b/runtime/caml/config.h
index e03bb7f928..1d7b4b0542 100644
--- a/runtime/caml/config.h
+++ b/runtime/caml/config.h
@@ -49,7 +49,6 @@
#ifndef CAML_CONFIG_H_NO_TYPEDEFS
#include <stddef.h>
-#include <stdbool.h>
#if defined(HAS_LOCALE_H) || defined(HAS_XLOCALE_H)
#define HAS_LOCALE
diff --git a/runtime/caml/frame_descriptors.h b/runtime/caml/frame_descriptors.h
index 3dc73e84e4..71142a5550 100644
--- a/runtime/caml/frame_descriptors.h
+++ b/runtime/caml/frame_descriptors.h
@@ -21,6 +21,7 @@
#ifdef CAML_INTERNALS
+#include <stdbool.h>
#include "config.h"
/* The compiler generates a "frame descriptor" for every potential
diff --git a/runtime/weak.c b/runtime/weak.c
index ee72f635db..6ac6e22568 100644
--- a/runtime/weak.c
+++ b/runtime/weak.c
@@ -319,7 +319,7 @@ static value ephe_get_field_copy (value e, mlsize_t offset)
/* Loop in case allocating the copy triggers a GC which modifies the
* ephemeron or the value. In the common case, we go around this
* loop 1.5 times. */
- while(true) {
+ while (1) {
clean_field(e, offset);
val = Field(e, offset);