Closed Bug 1141731 Opened 5 years ago Closed 5 years ago

build breakage: dist/include/malloc_decls.h:54:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]

Categories

(Core :: Memory Allocator, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- disabled
firefox40 --- fixed

People

(Reporter: keeler, Assigned: glandium)

References

Details

Attachments

(2 files, 1 obsolete file)

Build currently fails with clang on linux with:

 0:25.98 In file included from /home/keeler/mozilla-central/obj-x86_64-unknown-linux-gnu/memory/mozalloc/Unified_cpp_memory_mozalloc0.cpp:2:
 0:25.98 In file included from /home/keeler/mozilla-central/memory/mozalloc/mozalloc.cpp:29:
 0:25.99 ../../dist/include/malloc_decls.h:54:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
 0:25.99 MALLOC_DECL(malloc_good_size, size_t, size_t)
 0:25.99 ^
 0:25.99 /home/keeler/mozilla-central/memory/mozalloc/mozalloc.cpp:27:14: note: expanded from macro 'MALLOC_DECL'
 0:25.99   extern "C" MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__);
 0:25.99              ^
 0:25.99 ../../dist/include/mozmemory_wrap.h:146:32: note: expanded from macro 'MOZ_MEMORY_API'
 0:25.99 #        define MOZ_MEMORY_API MFBT_API
 0:25.99                                ^
 0:25.99 ../../dist/include/mozilla/Types.h:82:24: note: expanded from macro 'MFBT_API'
 0:25.99 #  define MFBT_API     MOZ_EXPORT
 0:25.99                        ^
 0:25.99 ../../dist/include/mozilla/Types.h:44:45: note: expanded from macro 'MOZ_EXPORT'
 0:25.99 #    define MOZ_EXPORT       __attribute__((visibility("default")))
 0:25.99                                             ^
 0:25.99 ../../dist/include/mozmemory.h:41:22: note: previous definition is here
 0:25.99 static inline size_t _malloc_good_size(size_t size) {
 0:25.99                      ^
 0:25.99 1 error generated.

hg bisect says bug 868814 caused this.
I can't reproduce locally. What's your mozconfig?
Attached file .mozconfig
ac_add_options --enable-warnings-as-errors is probably the relevant part
nsm and I both ran into this, too.

nsm discovered that you can hack around this (locally) by commenting out the "define malloc_good_size" line in memory/build/mozmemory.h.
(FWIW, I'm using clang 3.7, and nsm's using clang 3.5.1. We're both on linux.)
Version: unspecified → Trunk
Assignee: nobody → mh+mozilla
Attachment #8575655 - Flags: review?(n.nethercote)
Comment on attachment 8575655 [details] [diff] [review]
Avoid problems caused by the inclusion of mozmemory.h in mozalloc.cpp by including mozmemory_wrap.h instead

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

rs=me
Attachment #8575655 - Flags: review?(n.nethercote) → review+
Comment on attachment 8575742 [details] [diff] [review]
Avoid problems caused by the inclusion of mozmemory.h in mozalloc.cpp by including mozmemory_wrap.h instead

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

rs=me
Attachment #8575742 - Flags: review?(n.nethercote) → review+
https://hg.mozilla.org/mozilla-central/rev/22aea188dac5
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Depends on: 1173683
You need to log in before you can comment on or make changes to this bug.