Closed Bug 72563 Opened 25 years ago Closed 25 years ago

Wrong calling convention in some files

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: mkaply, Assigned: jband_mozilla)

References

Details

Attachments

(1 file)

Attached diff is of some xpconnect files where JS_DLL_CALLBACK was used instead of PR_CALLBACK and vice versa. In addition, I am removing unnecessary IBM legal cruft at the top of a couple files.
Blocks: 72050
a=jband. FWIW, I've been switching to the 'JS_STATIC_DLL_CALLBACK(JSBool)' form rather than 'static JSBool JS_DLL_CALLBACK'. Clearly, I have not got them all! Can you point me at a doc that better clarifies the rules - and when doing it wrong causes bustage rather than just slightly lower performance? I've got a branch full of changes for xpconnect and I'd rather get it right the first time. Thanks.
I'll use the JS_STATIC_CALLBACK here as well. Sometimes it looks better to do a quick switch from PR_CALLBACK to JS_DLL_CALLBACK because it is rather obvious what has changed in the diff. So you want documentation. Well, I have yet to find anything, but here is what we have learned and talked with the NSPR folk about. PR_CALLBACK should ONLY be used for functions that need to be passed to NSPR. There are some small exceptions (like plevent) but they usually related to code that we removed from NSPR and placed into the main trunk. The JS_CALLBACKs are for anything that needs to be passed to JS via a function or JS structure. There are some other things in the tree that are taking PR_CALLBACKs right now that aren't NSPR and I am working on cleaning those up. We are the only compiler that can actually force a break in these areas, so I am able to find them. We essentially switch NSPR to a different calling convention and then watch the fireworks. I tend to just look at the function - if it begins with PR_, it's a PR_CALLBACK, if it begins with JS_ or it is in a JSstructure, use JS_CALLBACK. Sorry I can't give more info then that. Note that there really aren't any performance implications associated with any of this - it's mainly a platform thing. Since most compilers use the same calling convention througout Mozilla the whole thing is moot. On OS/2, we actually get broken by some changes because of things we did wrong in the first place - that's why I'm trying to clean this up - it will be much more clear what breaks and what doesn't. Right now, people add in new code, OS/2 breaks and we add a cast or PR_CALLBACK to fix it - usually the right thing. I'm working on trying to come up with a better explanation of all this, and when I do, I will make it available to everyone.
Fix checked in
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Marking Verified -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: