From ede0322224eac3a4490c8ca8ad6b88d7e4dd66f0 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Thu, 22 Jan 2026 17:23:36 +0000 Subject: [PATCH] Revert "Merge pull request PR#14370 from MisterDA/cxx-headers-compat" This reverts commit 0ba65b608ffb08cc405173d7d70cdae6bac9d17b, reversing changes made to 5f9cb866663118d656f706bdf6b70159c3198b76. --- otherlibs/unix/caml/unixsupport.h | 5 +---- runtime/addrmap.c | 8 ++++---- runtime/caml/addrmap.h | 16 ++++++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/otherlibs/unix/caml/unixsupport.h b/otherlibs/unix/caml/unixsupport.h index de9483e05708..42ea48e737ee 100644 --- a/otherlibs/unix/caml/unixsupport.h +++ b/otherlibs/unix/caml/unixsupport.h @@ -44,10 +44,7 @@ struct filedescr { SOCKET socket; } fd; /* Real windows handle */ enum { KIND_HANDLE, KIND_SOCKET } kind; -#ifdef __cplusplus - std:: -#endif - atomic_int crt_fd; /* C runtime descriptor */ + _Atomic int crt_fd; /* C runtime descriptor */ unsigned int flags_fd; /* See FLAGS_FD_* */ }; diff --git a/runtime/addrmap.c b/runtime/addrmap.c index a2ac25633a25..a60ea7ae41f7 100644 --- a/runtime/addrmap.c +++ b/runtime/addrmap.c @@ -57,7 +57,7 @@ value caml_addrmap_lookup(struct addrmap* t, value key) for (uintnat pos = pos_initial(t, key); ; pos = pos_next(t, pos)) { CAMLassert(t->entries[pos].key != ADDRMAP_INVALID_KEY); if (t->entries[pos].key == key) - return t->entries[pos].val; + return t->entries[pos].value; } } @@ -68,7 +68,7 @@ static void addrmap_alloc(struct addrmap* t, uintnat sz) t->size = sz; for (uintnat i = 0; i < sz; i++) { t->entries[i].key = ADDRMAP_INVALID_KEY; - t->entries[i].val = ADDRMAP_NOT_PRESENT; + t->entries[i].value = ADDRMAP_NOT_PRESENT; } } @@ -98,7 +98,7 @@ value* caml_addrmap_insert_pos(struct addrmap* t, value key) { t->entries[pos].key = key; } if (t->entries[pos].key == key) { - return &t->entries[pos].val; + return &t->entries[pos].value; } } /* failed to insert, rehash and try again */ @@ -110,7 +110,7 @@ value* caml_addrmap_insert_pos(struct addrmap* t, value key) { if (old_table[i].key != ADDRMAP_INVALID_KEY) { value* p = caml_addrmap_insert_pos(t, old_table[i].key); CAMLassert(*p == ADDRMAP_NOT_PRESENT); - *p = old_table[i].val; + *p = old_table[i].value; } } caml_stat_free(old_table); diff --git a/runtime/caml/addrmap.h b/runtime/caml/addrmap.h index e9861a491492..b1e418085560 100644 --- a/runtime/caml/addrmap.h +++ b/runtime/caml/addrmap.h @@ -15,14 +15,16 @@ #ifndef CAML_ADDRMAP_H #define CAML_ADDRMAP_H -#ifdef CAML_INTERNALS - #include "mlvalues.h" +#ifdef __cplusplus +extern "C" { +#endif + /* An addrmap is a value -> value hashmap, where the values are blocks */ -struct addrmap_entry { value key; value val; }; +struct addrmap_entry { value key, value; }; struct addrmap { struct addrmap_entry* entries; uintnat size; @@ -82,14 +84,14 @@ Caml_inline value caml_addrmap_iter_value(struct addrmap* t, addrmap_iterator i) { CAMLassert(caml_addrmap_iter_ok(t, i)); - return t->entries[i].val; + return t->entries[i].value; } Caml_inline value* caml_addrmap_iter_val_pos(struct addrmap* t, addrmap_iterator i) { CAMLassert(caml_addrmap_iter_ok(t, i)); - return &t->entries[i].val; + return &t->entries[i].value; } Caml_inline addrmap_iterator caml_addrmap_iterator(struct addrmap* t) @@ -97,6 +99,8 @@ Caml_inline addrmap_iterator caml_addrmap_iterator(struct addrmap* t) return caml_addrmap_next(t, (uintnat)(-1)); } -#endif /* CAML_INTERNALS */ +#ifdef __cplusplus +} +#endif #endif /* CAML_ADDRMAP_H */