Page MenuHomeFreeBSD

sys/stdatomic.h: be nicer to c++
ClosedPublic

Authored by kib on Mar 27 2022, 9:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 29, 11:33 PM
Unknown Object (File)
Sun, Dec 29, 11:32 PM
Unknown Object (File)
Sun, Dec 29, 11:29 PM
Unknown Object (File)
Sun, Dec 15, 8:21 PM
Unknown Object (File)
Nov 18 2024, 4:11 AM
Unknown Object (File)
Oct 16 2024, 2:03 PM
Unknown Object (File)
Oct 5 2024, 6:40 AM
Unknown Object (File)
Sep 30 2024, 11:32 AM
Subscribers

Details

Summary
Use of stdatomic.h is undefined in C++, even C++ 2000 standard does not
list stdatomic.h as a C library header supported by the language.  More,
there are some subtle differences between the <atomic> C++ header, and
C11+ stdatomic.h.

Nonetheless, it is a quality of the implementation aspect, so let mis-users
mis-use stdatomic.h as they want, by making a compat shim for _Bool.

PR:     262683
Reported by:    yuri

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Mar 27 2022, 9:29 PM

LGTM. Have you seen a particular piece of C++ software that either accidentally or purposefully includes stdatomic.h?

This revision is now accepted and ready to land.Mar 27 2022, 10:11 PM
In D34686#785864, @dim wrote:

LGTM. Have you seen a particular piece of C++ software that either accidentally or purposefully includes stdatomic.h?

I reacted to the PR, nothing more. Perhaphs yuri@ can comment more.

In D34686#785864, @dim wrote:

LGTM. Have you seen a particular piece of C++ software that either accidentally or purposefully includes stdatomic.h?

JUCE framework includes <stdatomic.h> here: https://github.com/surge-synthesizer/JUCE/blob/086b21be1b08442631dcb58a9abc12acd48fce0a/modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp#L59

This revision was automatically updated to reflect the committed changes.