Closed Bug 905243 Opened 7 years ago Closed 7 years ago

make mozilla::Atomic constructors constexpr

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: froydnj, Assigned: tbsaunde)

References

Details

Attachments

(2 files)

No description provided.
People often use Atomic<T> as top-level global variables.  Such uses generate
static constructors for some compilers.  This seems undesirable, and contrary
to <atomic>, where std::atomic::atomic(T) is already constexpr, and the no-arg
constructor is |= default|.  We can do roughly the same thing in our wrapper
(though we don't have |= default|), and we should, to be efficient.
Attachment #790307 - Flags: review?(jwalden+bmo)
Comment on attachment 790419 [details] [diff] [review]
bug 905243 - make the constructors for mozilla::Atomic constexpr

Review of attachment 790419 [details] [diff] [review]:
-----------------------------------------------------------------

r=me if you:

- add #include "mozilla/Attributes.h" for MOZ_CONSTEXPR;
- add the appropriate MOZ_CONSTEXPR bits for the IsEnum specialization also.
Attachment #790419 - Flags: review?(nfroyd) → review+
Comment on attachment 790307 [details] [diff] [review]
make mozilla::Atomic constructors constexpr

Trevor has virtually the same patch.
Attachment #790307 - Flags: review?(jwalden+bmo)
https://hg.mozilla.org/integration/mozilla-inbound/rev/83ba61bc9500
Assignee: nobody → trev.saunders
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/83ba61bc9500
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.