RESOLVED FIXED 180600
bmalloc StaticMutex's constructor should be constexpr
https://bugs.webkit.org/show_bug.cgi?id=180600
Summary bmalloc StaticMutex's constructor should be constexpr
Yusuke Suzuki
Reported 2017-12-08 12:39:43 PST
bmalloc StaticMutex's constructor should be constexpr
Attachments
Patch (2.75 KB, patch)
2017-12-08 12:42 PST, Yusuke Suzuki
no flags
Patch (3.04 KB, patch)
2017-12-08 12:49 PST, Yusuke Suzuki
no flags
Patch (72.90 KB, patch)
2018-04-05 09:22 PDT, Yusuke Suzuki
no flags
Patch (72.87 KB, patch)
2018-04-05 09:24 PDT, Yusuke Suzuki
no flags
Patch (72.87 KB, patch)
2018-04-05 09:34 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2017-12-08 12:42:55 PST
Yusuke Suzuki
Comment 2 2017-12-08 12:49:19 PST
Yusuke Suzuki
Comment 3 2018-04-04 07:25:22 PDT
Comment on attachment 328855 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328855&action=review > Source/bmalloc/bmalloc/StaticMutex.h:50 > + std::atomic_flag m_isSpinning = ATOMIC_FLAG_INIT; hmm, it is not constexpr (according to the spec). Maybe, we cannot use std::atomic_flag { ATOMIC_FLAG_INIT } since this form is not described in the spec. And even if we use { ATOMIC_FLAG_INIT }, it is still not constexpr. Note that std::atomic<bool> has a constexpr constructor.
JF Bastien
Comment 4 2018-04-05 08:41:35 PDT
(In reply to Yusuke Suzuki from comment #3) > Comment on attachment 328855 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=328855&action=review > > > Source/bmalloc/bmalloc/StaticMutex.h:50 > > + std::atomic_flag m_isSpinning = ATOMIC_FLAG_INIT; > > hmm, it is not constexpr (according to the spec). Maybe, we cannot use > std::atomic_flag { ATOMIC_FLAG_INIT } since this form is not described in > the spec. And even if we use { ATOMIC_FLAG_INIT }, it is still not constexpr. > Note that std::atomic<bool> has a constexpr constructor. The one thing atomic<bool> doesn't have in theory is guaranteed lock-free... but in practice it does. Otherwise it's more capable in every way than atomic_flag (until we improve atomic_flag for C++20). So yeah atomic<bool> is better :-)
Yusuke Suzuki
Comment 5 2018-04-05 08:54:14 PDT
Comment on attachment 328855 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328855&action=review >>> Source/bmalloc/bmalloc/StaticMutex.h:50 >>> + std::atomic_flag m_isSpinning = ATOMIC_FLAG_INIT; >> >> hmm, it is not constexpr (according to the spec). Maybe, we cannot use std::atomic_flag { ATOMIC_FLAG_INIT } since this form is not described in the spec. And even if we use { ATOMIC_FLAG_INIT }, it is still not constexpr. >> Note that std::atomic<bool> has a constexpr constructor. > > The one thing atomic<bool> doesn't have in theory is guaranteed lock-free... but in practice it does. Otherwise it's more capable in every way than atomic_flag (until we improve atomic_flag for C++20). > > So yeah atomic<bool> is better :-) OK, I'll change it to std::atomic<bool>
Yusuke Suzuki
Comment 6 2018-04-05 09:22:17 PDT
EWS Watchlist
Comment 7 2018-04-05 09:24:06 PDT
Attachment 337265 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/Mutex.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/bmalloc/bmalloc/Mutex.cpp:42: More than one command on the same line [whitespace/newline] [4] ERROR: Source/bmalloc/bmalloc/Mutex.h:43: try_lock is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/bmalloc/bmalloc/Mutex.h:74: Mutex::try_lock is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 4 in 38 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 8 2018-04-05 09:24:51 PDT
Yusuke Suzuki
Comment 9 2018-04-05 09:34:10 PDT
EWS Watchlist
Comment 10 2018-04-05 09:37:17 PDT
Attachment 337270 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/Mutex.cpp:27: Found header this file implements before WebCore config.h. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] ERROR: Source/bmalloc/bmalloc/Mutex.cpp:42: More than one command on the same line [whitespace/newline] [4] ERROR: Source/bmalloc/bmalloc/Mutex.h:43: try_lock is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/bmalloc/bmalloc/Mutex.h:74: Mutex::try_lock is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 4 in 38 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 11 2018-04-05 10:45:29 PDT
Comment on attachment 337270 [details] Patch r=me
Yusuke Suzuki
Comment 12 2018-04-05 10:46:59 PDT
Comment on attachment 337270 [details] Patch Thank you!
WebKit Commit Bot
Comment 13 2018-04-05 11:07:34 PDT
Comment on attachment 337270 [details] Patch Clearing flags on attachment: 337270 Committed r230308: <https://trac.webkit.org/changeset/230308>
WebKit Commit Bot
Comment 14 2018-04-05 11:07:35 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15 2018-04-05 11:08:21 PDT
Note You need to log in before you can comment on or make changes to this bug.