Closed Bug 1383919 Opened 8 years ago Closed 8 years ago

Avoid "dynamic exception specifications are deprecated in C++11" warning with GCC 7

Categories

(Core :: Memory Allocator, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: botond, Assigned: botond)

References

Details

Attachments

(1 file)

When building trunk with GCC 7, I see warnings like this: 0:17.55 /home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/mozilla/mozalloc.h:180:52: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated] 0:17.55 #define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS throw(std::bad_alloc) 0:17.55 ^ 0:17.55 /home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/mozilla/mozalloc.h:183:34: note: in expansion of macro ‘MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS’ 0:17.55 #define MOZALLOC_THROW_BAD_ALLOC MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS 0:17.55 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0:17.55 /home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/mozilla/mozalloc.h:192:33: note: in expansion of macro ‘MOZALLOC_THROW_BAD_ALLOC’ 0:17.55 void* operator new(size_t size) MOZALLOC_THROW_BAD_ALLOC 0:17.55 ^~~~~~~~~~~~~~~~~~~~~~~~ Basically, we are using |throw(std::bad_alloc)|, but dynamic exception specifications have been deprecated in C++11. The C++11 equivalent is |noexcept(false)|. It should be straightforward to use |noexcept(false)| when appropriate.
Assignee: nobody → botond
Comment on attachment 8889692 [details] Bug 1383919 - Use |noexcept| instead of an exception-specification in mozalloc.h. https://reviewboard.mozilla.org/r/160754/#review168650
Attachment #8889692 - Flags: review?(mh+mozilla) → review+
Pushed by bballo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ae7e3082d862 Use |noexcept| instead of an exception-specification in mozalloc.h. r=glandium
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: