Closed Bug 227074 Opened 22 years ago Closed 22 years ago

nsTraceRefcnt.h should not include stdio.h

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(1 file, 1 obsolete file)

nsTraceRefcnt.h is now part of the SDK (and should be working; see bug 226555). It includes <stdio.h>. If we want to remove that, it would be better to do it now rather than once SDK users start depending on our headers bringing in stdio.h. It should also speed up compilation a bit. (This was needed in the old nsTraceRefcnt.h before the glue/base split, since it had FILE* parameters for some functions, but it's not needed now.)
It's not going to speed up compilation much since nsString2.h includes stdio.h as well, so anyone including the unfrozen string classes by nsString.h / nsString2.h will get stdio.h as well. This also makes it much easier to fix, since fewer includes need to be added...
One way to avoid over-including stdio.h is to depend on the FILE macro (which is always a macro, AFAICT -- but probably the standard does not require it to be a macro rather than a typedef), and bracket uses of FILE with #ifdef FILE, so that callers wanting the FILE-dependent declarations to be visible must include stdio.h themselves, first. Cc'ing darin, who has a plan for strings. We should get some bugs on file there. /be
I don't think the string headers actually *need* to include stdio.h for any reason. They just do...
Attached patch patch (obsolete) — Splinter Review
This is what I needed to compile with the include removed. I should probably test on another platform, although I could just let tinderbox tell me...
Comment on attachment 136506 [details] [diff] [review] patch Any reason not to include <> headers before "" ones? That is standard operating procedure where I come from. It would also match, e.g., the location of the <stdlib.h> include in the first file in the patch. /be
Attached patch patchSplinter Review
Attachment #136506 - Attachment is obsolete: true
Attachment #137261 - Flags: review?(dougt) → review+
Comment on attachment 137261 [details] [diff] [review] patch I want to get this in so external users of this header don't depend on it including stdio.h.
Attachment #137261 - Flags: superreview?(brendan)
Attachment #137261 - Flags: approval1.6?
Comment on attachment 137261 [details] [diff] [review] patch Sure, Asa agrees with safe code-level fixes and hygiene improvements like this being shotgunned in. BLAM! /be
Attachment #137261 - Flags: superreview?(brendan)
Attachment #137261 - Flags: superreview+
Attachment #137261 - Flags: approval1.6?
Attachment #137261 - Flags: approval1.6+
Fix checked in to trunk, 2003-12-12 15:02 -0800.
Status: NEW → RESOLVED
Closed: 22 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: