Open Bug 707396 Opened 13 years ago Updated 2 years ago

Ensure PR_(ABS|MAX|MIN|ROUNDUP) can't be used in CPP code anymore

Categories

(Core :: General, defect)

defect

Tracking

()

People

(Reporter: sgautherie, Unassigned)

References

()

Details

Bug 512106 comment 0:
{
I think we should switch to using NS_MIN/NS_MAX instead, in all C++ code
if we can, and then #undef these macros in a central location to protect
us from mistakes (like bug 511482).
}

This would have prevented bug 707395, for example.

Instead_of/In_addition_to undefining NS_MIN/NS_MAX, they should be redefined as explicit build error messages.
Ah, I just noticed the following comment:

(In reply to Mats Palmgren [:mats] from bug 512106 comment #15)
> I don't think adding an #undef in a header somewhere will help much
> since it needs to come after the #include of prtypes.h to have an effect.
> The best would be to remove them from prtypes.h but I suspect we can't
> do that.  We should simply stop using other things from that header file,
> PRBool for example, and then eventually we can just remove the #include.

Iirc, s/PRBool/bool/g has been done (at least to some extent).

Maybe morph this bug to (a meta bug) "Stop including prtypes.h"?
http://mxr.mozilla.org/mozilla-central/search?string=prtypes.h&case=1
"Found 321 matching lines in 313 files"
http://mxr.mozilla.org/comm-central/search?string=prtypes.h&case=1
"Found 345 matching lines in 337 files"
Summary: Ensure NS_MIN/NS_MAX can't be used in CPP code anymore → Ensure PR_(ABS|MAX|MIN|ROUNDUP) can't be used in CPP code anymore
Depends on: 708274
Depends on: 708277
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.