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)
Tue, Sep 24, 9:55 PM
Unknown Object (File)
Tue, Sep 24, 7:50 AM
Unknown Object (File)
Mon, Sep 23, 11:25 PM
Unknown Object (File)
Tue, Sep 17, 9:27 PM
Unknown Object (File)
Tue, Sep 17, 5:13 AM
Unknown Object (File)
Mon, Sep 16, 10:07 PM
Unknown Object (File)
Sun, Sep 15, 1:47 AM
Unknown Object (File)
Thu, Sep 12, 9:00 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 Skipped
Unit
Tests Skipped

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.