Skip to content

c++ support: move basic atomic type definitions to misc.h - #14139

Merged
Octachron merged 1 commit into
ocaml:trunkfrom
Octachron:cpp_compatibility
Jul 15, 2025
Merged

c++ support: move basic atomic type definitions to misc.h#14139
Octachron merged 1 commit into
ocaml:trunkfrom
Octachron:cpp_compatibility

Conversation

@Octachron

Copy link
Copy Markdown
Member

This PR fixes #14101 by moving the definitions of atomic_uintnat and atomic_intnat in misc.h.

Note that this only fixes the C++ uses of misc.h when CAML_INTERNALS is defined which is not really supported.

@gasche gasche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that having this in misc.h makes sense. Approved.

It would be nice to have a more general macro to deal with the differences between C and C++ on atomic types. Currently there are two definitions in misc.h that are hidden to C++, just because they use _Atomic: fatal_error_hook and scan_roots_hook. (Could we simply have a TYPEDEF_ATOMIC(uintnat, atomic_uintnat) macro for example?)

@Octachron
Octachron force-pushed the cpp_compatibility branch from 23d68aa to 2105aac Compare July 15, 2025 07:06
@Octachron
Octachron merged commit e92e87f into ocaml:trunk Jul 15, 2025
24 checks passed
Octachron added a commit that referenced this pull request Jul 15, 2025
c++ support: move basic atomic type definitions to misc.h

(cherry picked from commit e92e87f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5.4 regression: C++ compilers fail to compile misc.h

2 participants