NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT not defined when mozalloc.h is indirectly included in embedding code

RESOLVED FIXED in mozilla7

Status

()

Core
XPCOM
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: glandium, Assigned: glandium)

Tracking

Trunk
mozilla7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

6 years ago
When building e.g. external binary xpcom components with mozalloc (which is supposedly the default), including nsISupports.h (which is necessary when you use your own interfaces) includes nscore.h which includes mozalloc.h. That leads to a failure to build, since NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT are not defined. They are defined in mozilla-config.h (which is included from nowhere), but it seems wrong to rely on the fact that the compiler used to build the component supports the same things as the compiler used to build the sdk.
(Assignee)

Comment 1

6 years ago
Created attachment 537499 [details] [diff] [review]
Safeguard NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in mozalloc.h
Attachment #537499 - Flags: review?(benjamin)

Comment 2

6 years ago
Comment on attachment 537499 [details] [diff] [review]
Safeguard NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in mozalloc.h

I think the correct thing to do here is add these to xpcom-config.h.in and include xpcom-config.h from this file.
Attachment #537499 - Flags: review?(benjamin) → review-
(Assignee)

Comment 3

6 years ago
Created attachment 537705 [details] [diff] [review]
Define NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in xpcom-config.h, and include it from mozalloc.h
(Assignee)

Updated

6 years ago
Attachment #537499 - Attachment is obsolete: true
(Assignee)

Updated

6 years ago
Attachment #537705 - Flags: review?(benjamin)

Updated

6 years ago
Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED

Updated

6 years ago
Attachment #537705 - Flags: review?(benjamin) → review+
(Assignee)

Comment 4

6 years ago
Created attachment 540648 [details] [diff] [review]
Define NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in xpcom-config.h, and include it from mozalloc.h.

As I'm going to land: we need to add $(DEPTH)/xpcom to the include path so that xpcom-config.h is found when building mozalloc, which is built before xpcom-config.h is copied into dist/bin.
(Assignee)

Comment 5

6 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/d959aeca8307
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/d959aeca8307
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla7
You need to log in before you can comment on or make changes to this bug.