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)
Sat, May 31, 4:26 AM
Unknown Object (File)
Thu, May 29, 10:45 AM
Unknown Object (File)
Mon, May 26, 11:26 PM
Unknown Object (File)
Tue, May 20, 2:57 AM
Unknown Object (File)
Sat, May 17, 1:29 AM
Unknown Object (File)
Fri, May 16, 10:54 PM
Unknown Object (File)
Fri, May 16, 4:45 PM
Unknown Object (File)
Fri, May 16, 10:21 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.