Closed Bug 662224 Opened 13 years ago Closed 13 years ago

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

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(2 files, 1 obsolete file)

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.
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-
Attachment #537499 - Attachment is obsolete: true
Attachment #537705 - Flags: review?(benjamin)
Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED
Attachment #537705 - Flags: review?(benjamin) → review+
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.
http://hg.mozilla.org/mozilla-central/rev/d959aeca8307
Status: ASSIGNED → RESOLVED
Closed: 13 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.

Attachment

General

Created:
Updated:
Size: