Closed Bug 552329 Opened 14 years ago Closed 14 years ago

Fix GCC warnings in TestOOM.cpp

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 these compile warnings when building mozilla-central on Linux, in TestOOM.cpp:

>../../../mozilla/xpcom/tests/TestOOM.cpp: In function ‘int main(int, char**)’:
>../../../mozilla/xpcom/tests/TestOOM.cpp:80: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘size_t’
>../../../mozilla/xpcom/tests/TestOOM.cpp:83: warning: comparison between signed and unsigned integer expressions
>../../../mozilla/xpcom/tests/TestOOM.cpp:95: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘unsigned int’
>../../../mozilla/xpcom/tests/TestOOM.cpp:64: warning: unused variable ‘big_alloc’

I'm filing this bug on fixing these warnings.
Attached patch fixSplinter Review
Fixed in this patch:
 - Use (void) to indicate that it's ok we're not using variable 'big_alloc'
 - s/%ld/%lu/ in printf formats
 - Cast the corresponding printf arg to be an unsigned long (since size_t doesn't necessarily occupy the same number of bytes as 'unsigned' or 'unsigned long')
 - s/int/size_t/ in loop variable (to fix signed/unsigned comparison)
 - Replace tabs with spaces
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #432495 - Flags: review?(dougt)
Comment on attachment 432495 [details] [diff] [review]
fix

rs
Attachment #432495 - Flags: review?(dougt) → review+
Whiteboard: [build_warning]
Landed 2 months back, but forgot to note here & close bug:
  http://hg.mozilla.org/mozilla-central/rev/138f593553b6
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: