Last Comment Bug 662224 - NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT not defined when mozalloc.h is indirectly included in embedding code
: NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT not defined when mozalloc.h is indir...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla7
Assigned To: Mike Hommey [:glandium]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-05 22:05 PDT by Mike Hommey [:glandium]
Modified: 2011-06-21 06:49 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Safeguard NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in mozalloc.h (1.08 KB, patch)
2011-06-05 22:07 PDT, Mike Hommey [:glandium]
benjamin: review-
Details | Diff | Splinter Review
Define NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in xpcom-config.h, and include it from mozalloc.h (1.46 KB, patch)
2011-06-06 18:10 PDT, Mike Hommey [:glandium]
benjamin: review+
Details | Diff | Splinter Review
Define NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in xpcom-config.h, and include it from mozalloc.h. (1.84 KB, patch)
2011-06-20 18:30 PDT, Mike Hommey [:glandium]
no flags Details | Diff | Splinter Review

Description Mike Hommey [:glandium] 2011-06-05 22:05:45 PDT
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 1 Mike Hommey [:glandium] 2011-06-05 22:07:49 PDT
Created attachment 537499 [details] [diff] [review]
Safeguard NS_ATTR_MALLOC and NS_WARN_UNUSED_RESULT in mozalloc.h
Comment 2 Benjamin Smedberg [:bsmedberg] 2011-06-06 10:05:00 PDT
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.
Comment 3 Mike Hommey [:glandium] 2011-06-06 18:10:35 PDT
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
Comment 4 Mike Hommey [:glandium] 2011-06-20 18:30:37 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.