We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3745

Summary: specify SDLCALL as the calling convention for destructor() callback of SDL_TLSSet()
Product: SDL Reporter: Ozkan Sezer <sezeroz>
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: SDLCALL-2 patch
SDLCALL-2a -- SDL_LogOutputFunction
SDLCALL-2b
SDLCALL-2c -- SDL_blit

Description Ozkan Sezer 2017-08-13 17:16:25 UTC
Created attachment 2835 [details]
SDLCALL-2 patch

The attached patch specifies SDLCALL as the calling convention for the
destructor() callback of SDL_TLSSet().

At present nothing is specified and it is OK for most target/compiler
combinations.  However, there targets with different compilers who has
different default calling conventions (e.g. OS/2 with Watcom and gcc.)
So it is important to make it standard, as it is done everywhere else
in the SDL tree.
Comment 1 Ryan C. Gordon 2017-08-13 18:15:37 UTC
This will break ABI and source compatibility with previous SDL releases.
Comment 2 Ozkan Sezer 2017-08-13 18:18:37 UTC
> This will break ABI and source compatibility with previous SDL releases.

No, I don't think it will:  Addition of SDLCALL will be a nop for
all current targets as specified in begin_code.h, i.e. the existing
status will be still preserved for them.
Comment 3 Sam Lantinga 2017-08-14 04:02:32 UTC
I don't mind this change, but in order for it to be complete the same would have to be done for the other callbacks in the API. The hint callback, log output callback, etc.

Ozkan, would you mind going through and doing a complete update of all the API callbacks to the SDLCALL calling convention?

Thanks!
Comment 4 Ozkan Sezer 2017-08-14 09:11:27 UTC
Created attachment 2846 [details]
SDLCALL-2a -- SDL_LogOutputFunction

patch to make SDL_LogOutputFunction SDLCALL.
Comment 5 Ozkan Sezer 2017-08-14 09:12:37 UTC
Created attachment 2847 [details]
SDLCALL-2b

patch to make SDL_HintCallback SDLCALL.
Comment 6 Ozkan Sezer 2017-08-14 09:20:08 UTC
Added patches for log and hint callbacks, above.

There are SDLTest_TestCase??? callbacks, but I'm not sure whether
they need dictating a calling convention (as they are just for devs.)

AFAICS, only SDL_surface.h:SDL_blit is left now:  I am also taking a
closer look at the SDL_BlitFunc() (bug #3746) case to ensure that it
was not a mistake to remove SDLCALL from it.
Comment 7 Ozkan Sezer 2017-08-14 10:04:47 UTC
Created attachment 2848 [details]
SDLCALL-2c -- SDL_blit

patch to make SDL_blit SDLCALL.
Comment 8 Ozkan Sezer 2017-08-14 10:06:45 UTC
> AFAICS, only SDL_surface.h:SDL_blit is left now:

Added patch for it above.

Can you see anything I missed or anything I did wrong?

>  I am also taking a
> closer look at the SDL_BlitFunc() (bug #3746) case to ensure that
> it was not a mistake to remove SDLCALL from it.

AFAICS no, it was not a mistake.
Comment 9 Sam Lantinga 2017-08-14 13:28:39 UTC
Patches are in, thanks!
https://hg.libsdl.org/SDL/rev/3db78361e751