Closed Bug 1802649 Opened 1 year ago Closed 1 year ago

Fix C++20 -Wdeprecated-volatile warnings in dom/media

Categories

(Core :: Audio/Video, defect, P3)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(2 files)

C++20 deprecated decrement/increment of object of volatile-qualified types, e.g. v++.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1152r3.html

dom/media/systemservices/CamerasParent.cpp:1073:20: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]

If counter variable was incremented on the main thread, we could just remove the volatile. But it's incremented off the main thread, so we need to protect against races from multiple CamerasParent objects.

C++20 deprecated decrement/increment of object of volatile-qualified types, e.g. v++.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1152r3.html

dom/media/systemservices/CamerasParent.cpp:1073:20: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]

If counter variable was incremented on the main thread, we could just remove the volatile. But it's incremented off the main thread, so we need to protect against races from multiple CamerasParent objects.

Summary: Fix C++20 -Wdeprecated-volatile warning by replacing volatile variable with an atomic → Fix C++20 -Wdeprecated-volatile warnings in dom/media

C++20 deprecated decrement/increment of object of volatile-qualified types, e.g. v++.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1152r3.html

warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]

In this case, mInt doesn't need to be atomic. The test only cares that the Foo::Notify5() member function is volatile.

Depends on D163164

Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ed8fb724900a
Fix C++20 -Wdeprecated-volatile warning by replacing volatile variable with an atomic. r=media-playback-reviewers,padenot
https://hg.mozilla.org/integration/autoland/rev/26b9e9e304fc
Fix C++20 -Wdeprecated-volatile warning by replacing postfix increment with addition. r=media-playback-reviewers,padenot
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: