Closed Bug 1411613 Opened 8 years ago Closed 6 years ago

with -std=c++17, memory is failing to build with 'xxx' is missing exception specification 'throw()'

Categories

(Core :: Memory Allocator, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox58 --- wontfix
firefox71 --- fixed

People

(Reporter: Sylvestre, Assigned: froydnj)

References

Details

Attachments

(1 file)

In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/memory/build/Unified_cpp_memory_build0.cpp:11: In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:14: /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:51:1: error: 'free' is missing exception specification 'throw()' MALLOC_DECL(free, void, void *) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:12:30: note: expanded from macro 'MALLOC_DECL' MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__); ^ <scratch space>:160:1: note: expanded from here free_impl ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.h:148:53: note: expanded from macro 'free_impl' #define free_impl mozmem_malloc_impl(free) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:51:1: note: previous declaration is here MALLOC_DECL(free, void, void *) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozjemalloc.cpp:5205:52: note: expanded from macro 'MALLOC_DECL' #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__)) ^ In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/memory/build/Unified_cpp_memory_build0.cpp:11: In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:14: /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:55:1: error: 'posix_memalign' is missing exception specification 'throw()' MALLOC_DECL(posix_memalign, int, void **, size_t, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:12:30: note: expanded from macro 'MALLOC_DECL' MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__); ^ <scratch space>:162:1: note: expanded from here posix_memalign_impl ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.h:144:53: note: expanded from macro 'posix_memalign_impl' #define posix_memalign_impl mozmem_malloc_impl(posix_memalign) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:55:1: note: previous declaration is here MALLOC_DECL(posix_memalign, int, void **, size_t, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozjemalloc.cpp:5205:52: note: expanded from macro 'MALLOC_DECL' #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__)) ^ In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/memory/build/Unified_cpp_memory_build0.cpp:11: In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:14: /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:56:1: error: 'aligned_alloc' is missing exception specification 'throw()' MALLOC_DECL(aligned_alloc, void *, size_t, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:12:30: note: expanded from macro 'MALLOC_DECL' MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__); ^ <scratch space>:163:1: note: expanded from here aligned_alloc_impl ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.h:145:53: note: expanded from macro 'aligned_alloc_impl' #define aligned_alloc_impl mozmem_malloc_impl(aligned_alloc) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:56:1: note: previous declaration is here MALLOC_DECL(aligned_alloc, void *, size_t, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozjemalloc.cpp:5205:52: note: expanded from macro 'MALLOC_DECL' #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__)) ^ In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/memory/build/Unified_cpp_memory_build0.cpp:11: In file included from /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:14: /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:57:1: error: 'valloc' is missing exception specification 'throw()' MALLOC_DECL(valloc, void *, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.cpp:12:30: note: expanded from macro 'MALLOC_DECL' MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__); ^ <scratch space>:164:1: note: expanded from here valloc_impl ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozmemory_wrap.h:150:53: note: expanded from macro 'valloc_impl' #define valloc_impl mozmem_malloc_impl(valloc) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/malloc_decls.h:57:1: note: previous declaration is here MALLOC_DECL(valloc, void *, size_t) ^ /home/sylvestre/dev/mozilla/mozilla-central.hg/memory/build/mozjemalloc.cpp:5205:52: note: expanded from macro 'MALLOC_DECL' #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__))
Not that I expect it would fix anything, but if you're going to try new C++ standards, you should use -std=gnu++xx instead of -std=c++xx. Also, we're on C++11 currently, and we can hardly bump to C++14, so C++17 is still a loooong way.
Priority: -- → P4
No longer blocks: 1566181

glibc marks various allocation functions as throw(). This addition
hasn't been a problem until we tried to enable C++17, where clang
started complaining that we were redeclaring functions with mismatched
exception specifications. Peculiarly, glibc declares virtually
everything we redeclare as throw(), but clang only complains about the
mismatches for a particular subset of functions.

The approach taken in this patch is to add another potentially defined
macro to malloc_decls.h, NOTHROW_MALLOC_DECL. This macro works
exactly like MALLOC_DECL, except that clients can define
NOTHROW_MALLOC_DECL to add appropriate throw() specifiers when
declaring functions at global scope, and thereby avoid mismatched
exception specifications.

Pushed by nfroyd@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/55974feb88c1 mark certain allocation functions as non-throwing; r=glandium
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → nfroyd
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: