Closed Bug 31548 Opened 25 years ago Closed 25 years ago

[patch] The define of NS_DEBUG gives me a compilation warning.

Categories

(Core :: XPCOM, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED WONTFIX

People

(Reporter: jonas.utterstrom, Assigned: dp)

Details

(Keywords: verifyme)

Attachments

(1 file)

In my application, I have both NS_DEBUG and DEBUG define. This gives a
compilation warning when I've included nsDebug.h. So please have a look at the
patch I have attached to this bug.
Yeah your patch looks ok.

Considering that nsDebug.h is the one defining NS_DEBUG, I would like to know 
how we can end up with a warning of multiple define.

Can you explain how it is happening ?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Status: NEW → ASSIGNED
Summary: The define of NS_DEBUG gives me a compilation warning. → [patch] The define of NS_DEBUG gives me a compilation warning.
Target Milestone: M15
Well, it doesn't occur in Mozilla. But in my own applications that use the
Mozilla libraries I have to define NS_DEBUG due to the design of nsCOMPtr.
http://lxr.mozilla.org/seamonkey/source/xpcom/base/nsCOMPtr.h#98
Otherwise I will get link errors when using nsCOMPtr in my application. But some
of my code also defines DEBUG, which gives this annoying warning. 

And an extra ifdef guard wouldn't do any harm?
Yeah it is harmless. But usually these errors of multiple defines point in the
direction of incorrect usage. Hence my curiosity.

nsCOMPtr.h includes nsDebug.h  So if nsDebug.h defined NS_DEBUG in the first
place, things should be just fine.

Instead of defining NS_DEBUG, if you just define DEBUG either in a base header
file or in your build process as we do in mozilla, you should be fine. Right ?
I settle with DEBUG for now, but I think it's a too common used define.  I think
that before Mozilla is released something must be done to nsCOMPtr.h so that I
can use the Mozilla release libraries with my debug build application. And of
course the other way around.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → WONTFIX
Now that is a damn good suggestion. I will say wont fix and file a separate bug 
on that. ok ?
Adding verifyme keyword.
Keywords: verifyme
Marking Verified per dp's last comments.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: