Closed Bug 552330 Opened 14 years ago Closed 14 years ago

Fix compile warning - TestObserverArray.cpp:45:1: warning: "NS_ARRAY_LENGTH" redefined

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

I get this compile warning when building mozilla-central on linux:

>../../../mozilla/xpcom/tests/TestObserverArray.cpp:45:1: warning: "NS_ARRAY_LENGTH" redefined
>In file included from ../../dist/include/nsString.h:209,
>                 from ../../dist/include/nsStringGlue.h:49,
>                 from ../../../mozilla/xpcom/tests/TestHarness.h:51,
>                 from ../../../mozilla/xpcom/tests/TestObserverArray.cpp:40:
>../../dist/include/nsMemory.h:156:1: warning: this is the location of the previous definition

For some reason, TestObserverArray.cpp has its own personal declaration of NS_ARRAY_LENGTH.  It's effectively the same as the one in nsMemory.h. (The only difference is use of "*" vs "[0]" to get the size of the first array-element). The version in TestObserverArray.cpp should just be removed.
Attached patch fixSplinter Review
Presumably at some point since this test was checked in, it got an indirect #include of nsMemory.h.  (I assume that was the reason we directly included NS_ARRAY_LENGTH in the test in the first place.)

I'm including a direct #include just for good measure, in case the fortuitous indirect #include chain gets broken later on.

bz, mind rubber-stamping this tweak to your test?
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #432491 - Flags: review?(bzbarsky)
Thanks! pushed: http://hg.mozilla.org/mozilla-central/rev/4ad695657131
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: