From db96ddca344ad91aacab97084ac3795c06d3d6ed Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 6 Sep 2024 03:21:13 +0200
Subject: [PATCH] SDL_test: use SDLCALL calling convention
This is needed when using a pre-built static SDL3_test library.
---
include/SDL3/SDL_test_assert.h | 13 +-
include/SDL3/SDL_test_common.h | 26 ++--
include/SDL3/SDL_test_compare.h | 4 +-
include/SDL3/SDL_test_crc32.h | 12 +-
include/SDL3/SDL_test_font.h | 18 +--
include/SDL3/SDL_test_fuzzer.h | 50 +++----
include/SDL3/SDL_test_harness.h | 15 +-
include/SDL3/SDL_test_log.h | 4 +-
include/SDL3/SDL_test_md5.h | 14 +-
include/SDL3/SDL_test_memory.h | 8 +-
src/test/SDL_test_common.c | 12 +-
src/test/SDL_test_harness.c | 2 +-
test/testautomation_audio.c | 42 +++---
test/testautomation_blit.c | 8 +-
test/testautomation_clipboard.c | 12 +-
test/testautomation_events.c | 6 +-
test/testautomation_guid.c | 4 +-
test/testautomation_hints.c | 4 +-
test/testautomation_intrinsics.c | 20 +--
test/testautomation_iostream.c | 22 +--
test/testautomation_joystick.c | 2 +-
test/testautomation_keyboard.c | 26 ++--
test/testautomation_log.c | 2 +-
test/testautomation_main.c | 8 +-
test/testautomation_math.c | 232 +++++++++++++++----------------
test/testautomation_mouse.c | 24 ++--
test/testautomation_pixels.c | 6 +-
test/testautomation_platform.c | 20 +--
test/testautomation_properties.c | 10 +-
test/testautomation_rect.c | 70 +++++-----
test/testautomation_render.c | 28 ++--
test/testautomation_sdltest.c | 30 ++--
test/testautomation_stdlib.c | 22 +--
test/testautomation_subsystems.c | 12 +-
test/testautomation_surface.c | 48 +++----
test/testautomation_time.c | 6 +-
test/testautomation_timer.c | 10 +-
test/testautomation_video.c | 44 +++---
38 files changed, 444 insertions(+), 452 deletions(-)
diff --git a/include/SDL3/SDL_test_assert.h b/include/SDL3/SDL_test_assert.h
index 64a149d61fb90..4d857b2ab04af 100644
--- a/include/SDL3/SDL_test_assert.h
+++ b/include/SDL3/SDL_test_assert.h
@@ -54,7 +54,7 @@ extern "C" {
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
* \param assertDescription Message to log with the assert describing it.
*/
-void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+void SDLCALL SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/*
* Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
@@ -64,32 +64,31 @@ void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *as
*
* \returns the assertCondition so it can be used to externally to break execution flow if desired.
*/
-int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+int SDLCALL SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/*
* Explicitly pass without checking an assertion condition. Updates assertion counter.
*
* \param assertDescription Message to log with the assert describing it.
*/
-void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
+void SDLCALL SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
/*
* Resets the assert summary counters to zero.
*/
-void SDLTest_ResetAssertSummary(void);
+void SDLCALL SDLTest_ResetAssertSummary(void);
/*
* Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/
-void SDLTest_LogAssertSummary(void);
-
+void SDLCALL SDLTest_LogAssertSummary(void);
/*
* Converts the current assert summary state to a test result.
*
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
*/
-int SDLTest_AssertSummaryToTestResult(void);
+int SDLCALL SDLTest_AssertSummaryToTestResult(void);
#ifdef __cplusplus
}
diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h
index 5afa390abca00..85d1ec83fe5e1 100644
--- a/include/SDL3/SDL_test_common.h
+++ b/include/SDL3/SDL_test_common.h
@@ -55,10 +55,10 @@ typedef Uint32 SDLTest_VerboseFlags;
/* !< Function pointer parsing one argument at argv[index], returning the number of parsed arguments,
* or a negative value when the argument is invalid */
-typedef int (*SDLTest_ParseArgumentsFp)(void *data, char **argv, int index);
+typedef int (SDLCALL *SDLTest_ParseArgumentsFp)(void *data, char **argv, int index);
/* !< Finalize the argument parser. */
-typedef void (*SDLTest_FinalizeArgumentParserFp)(void *arg);
+typedef void (SDLCALL *SDLTest_FinalizeArgumentParserFp)(void *arg);
typedef struct SDLTest_ArgumentParser
{
@@ -179,7 +179,7 @@ extern "C" {
*
* \returns a newly allocated common state object.
*/
-SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags);
+SDLTest_CommonState *SDLCALL SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags);
/**
* Free the common state object.
@@ -188,7 +188,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags)
*
* \param state The common state object to destroy
*/
-void SDLTest_CommonDestroyState(SDLTest_CommonState *state);
+void SDLCALL SDLTest_CommonDestroyState(SDLTest_CommonState *state);
/**
* Process one common argument.
@@ -198,7 +198,7 @@ void SDLTest_CommonDestroyState(SDLTest_CommonState *state);
*
* \returns the number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
*/
-int SDLTest_CommonArg(SDLTest_CommonState *state, int index);
+int SDLCALL SDLTest_CommonArg(SDLTest_CommonState *state, int index);
/**
@@ -213,7 +213,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index);
* \param argv0 argv[0], as passed to main/SDL_main.
* \param options an array of strings for application specific options. The last element of the array should be NULL.
*/
-void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options);
+void SDLCALL SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options);
/**
* Open test window.
@@ -222,7 +222,7 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const
*
* \returns SDL_TRUE if initialization succeeded, false otherwise
*/
-SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state);
+SDL_bool SDLCALL SDLTest_CommonInit(SDLTest_CommonState *state);
/**
* Easy argument handling when test app doesn't need any custom args.
@@ -233,7 +233,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state);
*
* \returns SDL_FALSE if app should quit, true otherwise.
*/
-SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv);
+SDL_bool SDLCALL SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv);
/**
* Print the details of an event.
@@ -242,7 +242,7 @@ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, c
*
* \param event The event to print.
*/
-void SDLTest_PrintEvent(const SDL_Event *event);
+void SDLCALL SDLTest_PrintEvent(const SDL_Event *event);
/**
* Common event handler for test windows if you use a standard SDL_main.
@@ -251,7 +251,7 @@ void SDLTest_PrintEvent(const SDL_Event *event);
* \param event The event to handle.
* \param done Flag indicating we are done.
*/
-void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done);
+void SDLCALL SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done);
/**
* Common event handler for test windows if you use SDL_AppEvent.
@@ -262,7 +262,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
* \param event The event to handle.
* \returns Value suitable for returning from SDL_AppEvent().
*/
-SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event *event);
+SDL_AppResult SDLCALL SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event *event);
/**
* Close test window.
@@ -270,7 +270,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
* \param state The common state used to create test window.
*
*/
-void SDLTest_CommonQuit(SDLTest_CommonState *state);
+void SDLCALL SDLTest_CommonQuit(SDLTest_CommonState *state);
/**
* Draws various window information (position, size, etc.) to the renderer.
@@ -280,7 +280,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state);
* \param usedHeight Returns the height used, so the caller can draw more below.
*
*/
-void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, float *usedHeight);
+void SDLCALL SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, float *usedHeight);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_compare.h b/include/SDL3/SDL_test_compare.h
index 2aa84e00ae1ae..a7e18e3c7b505 100644
--- a/include/SDL3/SDL_test_compare.h
+++ b/include/SDL3/SDL_test_compare.h
@@ -53,7 +53,7 @@ extern "C" {
*
* \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
*/
-int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
+int SDLCALL SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
/**
* Compares 2 memory blocks for equality
@@ -67,7 +67,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
*
* \since This function is available since SDL 3.0.0.
*/
-extern int SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference);
+int SDLCALL SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_crc32.h b/include/SDL3/SDL_test_crc32.h
index e6316bcf5dacd..0079a245e9629 100644
--- a/include/SDL3/SDL_test_crc32.h
+++ b/include/SDL3/SDL_test_crc32.h
@@ -77,7 +77,7 @@ extern "C" {
* \returns 0 for OK, -1 on error
*
*/
- int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext);
+int SDLCALL SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext);
/*
@@ -91,12 +91,12 @@ extern "C" {
* \returns 0 for OK, -1 on error
*
*/
-int SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLCALL SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/* Same routine broken down into three steps */
-int SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLCALL SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
+int SDLCALL SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
+int SDLCALL SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/*
@@ -108,7 +108,7 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, C
*
*/
-int SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext);
+int SDLCALL SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext);
/* Ends C function definitions when using C++ */
diff --git a/include/SDL3/SDL_test_font.h b/include/SDL3/SDL_test_font.h
index 8a65fe9479789..1716c46a45f8c 100644
--- a/include/SDL3/SDL_test_font.h
+++ b/include/SDL3/SDL_test_font.h
@@ -56,7 +56,7 @@ extern int FONT_CHARACTER_SIZE;
*
* \returns SDL_TRUE on success, SDL_FALSE on failure.
*/
-SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c);
+SDL_bool SDLCALL SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c);
/*
* Draw a UTF-8 string in the currently set font.
@@ -70,7 +70,7 @@ SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32
*
* \returns SDL_TRUE on success, SDL_FALSE on failure.
*/
-SDL_bool SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s);
+SDL_bool SDLCALL SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s);
/*
* Data used for multi-line text output
@@ -95,7 +95,7 @@ typedef struct SDLTest_TextWindow
*
* \since This function is available since SDL 3.0.0.
*/
-SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h);
+SDLTest_TextWindow * SDLCALL SDLTest_TextWindowCreate(float x, float y, float w, float h);
/*
* Display a multi-line text output window
@@ -107,7 +107,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h)
*
* \since This function is available since SDL 3.0.0.
*/
-void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
+void SDLCALL SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
/*
* Add text to a multi-line text output window
@@ -122,7 +122,7 @@ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *render
*
* \since This function is available since SDL 3.0.0.
*/
-void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+void SDLCALL SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/*
* Add text to a multi-line text output window
@@ -137,7 +137,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_ST
*
* \since This function is available since SDL 3.0.0.
*/
-void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
+void SDLCALL SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
/*
* Clear the text in a multi-line text output window
@@ -146,7 +146,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
*
* \since This function is available since SDL 3.0.0.
*/
-void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
+void SDLCALL SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
/*
* Free the storage associated with a multi-line text output window
@@ -155,12 +155,12 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
*
* \since This function is available since SDL 3.0.0.
*/
-void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);
+void SDLCALL SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);
/*
* Cleanup textures used by font drawing functions.
*/
-void SDLTest_CleanupTextDrawing(void);
+void SDLCALL SDLTest_CleanupTextDrawing(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_fuzzer.h b/include/SDL3/SDL_test_fuzzer.h
index a935de21f8d6c..e507b53e5ad03 100644
--- a/include/SDL3/SDL_test_fuzzer.h
+++ b/include/SDL3/SDL_test_fuzzer.h
@@ -59,7 +59,7 @@ extern "C" {
* \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
*
*/
-void SDLTest_FuzzerInit(Uint64 execKey);
+void SDLCALL SDLTest_FuzzerInit(Uint64 execKey);
/**
@@ -67,14 +67,14 @@ void SDLTest_FuzzerInit(Uint64 execKey);
*
* \returns a generated integer
*/
-Uint8 SDLTest_RandomUint8(void);
+Uint8 SDLCALL SDLTest_RandomUint8(void);
/**
* Returns a random Sint8
*
* \returns a generated signed integer
*/
-Sint8 SDLTest_RandomSint8(void);
+Sint8 SDLCALL SDLTest_RandomSint8(void);
/**
@@ -82,14 +82,14 @@ Sint8 SDLTest_RandomSint8(void);
*
* \returns a generated integer
*/
-Uint16 SDLTest_RandomUint16(void);
+Uint16 SDLCALL SDLTest_RandomUint16(void);
/**
* Returns a random Sint16
*
* \returns a generated signed integer
*/
-Sint16 SDLTest_RandomSint16(void);
+Sint16 SDLCALL SDLTest_RandomSint16(void);
/**
@@ -97,7 +97,7 @@ Sint16 SDLTest_RandomSint16(void);
*
* \returns a generated integer
*/
-Sint32 SDLTest_RandomSint32(void);
+Sint32 SDLCALL SDLTest_RandomSint32(void);
/**
@@ -105,7 +105,7 @@ Sint32 SDLTest_RandomSint32(void);
*
* \returns a generated integer
*/
-Uint32 SDLTest_RandomUint32(void);
+Uint32 SDLCALL SDLTest_RandomUint32(void);
/**
* Returns random Uint64.
@@ -120,29 +120,29 @@ Uint64 SDLTest_RandomUint64(void);
*
* \returns a generated signed integer
*/
-Sint64 SDLTest_RandomSint64(void);
+Sint64 SDLCALL SDLTest_RandomSint64(void);
/**
* \returns a random float in range [0.0 - 1.0]
*/
-float SDLTest_RandomUnitFloat(void);
+float SDLCALL SDLTest_RandomUnitFloat(void);
/**
* \returns a random double in range [0.0 - 1.0]
*/
-double SDLTest_RandomUnitDouble(void);
+double SDLCALL SDLTest_RandomUnitDouble(void);
/**
* \returns a random float.
*
*/
-float SDLTest_RandomFloat(void);
+float SDLCALL SDLTest_RandomFloat(void);
/**
* \returns a random double.
*
*/
-double SDLTest_RandomDouble(void);
+double SDLCALL SDLTest_RandomDouble(void);
/**
* Returns a random boundary value for Uint8 within the given boundaries.
@@ -163,7 +163,7 @@ double SDLTest_RandomDouble(void);
*
* \returns a random boundary value for the given range and domain or 0 with error set
*/
-Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
+Uint8 SDLCALL SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Uint16 within the given boundaries.
@@ -184,7 +184,7 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo
*
* \returns a random boundary value for the given range and domain or 0 with error set
*/
-Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
+Uint16 SDLCALL SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Uint32 within the given boundaries.
@@ -205,7 +205,7 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL
*
* \returns a random boundary value for the given range and domain or 0 with error set
*/
-Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
+Uint32 SDLCALL SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Uint64 within the given boundaries.
@@ -226,7 +226,7 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL
*
* \returns a random boundary value for the given range and domain or 0 with error set
*/
-Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
+Uint64 SDLCALL SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Sint8 within the given boundaries.
@@ -247,7 +247,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL
*
* \returns a random boundary value for the given range and domain or SINT8_MIN with error set
*/
-Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
+Sint8 SDLCALL SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
/**
@@ -269,7 +269,7 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo
*
* \returns a random boundary value for the given range and domain or SINT16_MIN with error set
*/
-Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
+Sint16 SDLCALL SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Sint32 within the given boundaries.
@@ -290,7 +290,7 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL
*
* \returns a random boundary value for the given range and domain or SINT32_MIN with error set
*/
-Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
+Sint32 SDLCALL SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
/**
* Returns a random boundary value for Sint64 within the given boundaries.
@@ -311,7 +311,7 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL
*
* \returns a random boundary value for the given range and domain or SINT64_MIN with error set
*/
-Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
+Sint64 SDLCALL SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
/**
@@ -325,7 +325,7 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
*
* \returns a generated random integer in range
*/
-Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
+Sint32 SDLCALL SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
/**
@@ -337,7 +337,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
*
* \returns a newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/
-char *SDLTest_RandomAsciiString(void);
+char * SDLCALL SDLTest_RandomAsciiString(void);
/**
@@ -351,7 +351,7 @@ char *SDLTest_RandomAsciiString(void);
*
* \returns a newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
*/
-char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
+char * SDLCALL SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
/**
@@ -365,14 +365,14 @@ char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
*
* \returns a newly allocated random string; or NULL if size was invalid or string could not be allocated.
*/
-char *SDLTest_RandomAsciiStringOfSize(int size);
+char * SDLCALL SDLTest_RandomAsciiStringOfSize(int size);
/**
* Get the invocation count for the fuzzer since last ...FuzzerInit.
*
* \returns the invocation count.
*/
-int SDLTest_GetFuzzerInvocationCount(void);
+int SDLCALL SDLTest_GetFuzzerInvocationCount(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_harness.h b/include/SDL3/SDL_test_harness.h
index 65630d8487077..cc2a15f5a66f1 100644
--- a/include/SDL3/SDL_test_harness.h
+++ b/include/SDL3/SDL_test_harness.h
@@ -63,13 +63,13 @@ extern "C" {
#define TEST_RESULT_SETUP_FAILURE 4
/* !< Function pointer to a test case setup function (run before every test) */
-typedef void (*SDLTest_TestCaseSetUpFp)(void **arg);
+typedef void (SDLCALL *SDLTest_TestCaseSetUpFp)(void **arg);
/* !< Function pointer to a test case function */
-typedef int (*SDLTest_TestCaseFp)(void *arg);
+typedef int (SDLCALL *SDLTest_TestCaseFp)(void *arg);
/* !< Function pointer to a test case teardown function (run after every test) */
-typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
+typedef void (SDLCALL *SDLTest_TestCaseTearDownFp)(void *arg);
/*
* Holds information about a single test case.
@@ -109,7 +109,7 @@ typedef struct SDLTest_TestSuiteReference {
*
* \returns A null-terminated seed string and equal to the in put buffer on success, NULL on failure
*/
-char *SDLTest_GenerateRunSeed(char *buffer, int length);
+char * SDLCALL SDLTest_GenerateRunSeed(char *buffer, int length);
/*
* Holds information about the execution of test suites.
@@ -125,7 +125,7 @@ typedef struct SDLTest_TestSuiteRunner SDLTest_TestSuiteRunner;
*
* \returns the test run result: 0 when all tests passed, 1 if any tests failed.
*/
-SDLTest_TestSuiteRunner * SDLTest_CreateTestSuiteRunner(SDLTest_CommonState *state, SDLTest_TestSuiteReference *testSuites[]);
+SDLTest_TestSuiteRunner * SDLCALL SDLTest_CreateTestSuiteRunner(SDLTest_CommonState *state, SDLTest_TestSuiteReference *testSuites[]);
/*
* Destroy a test suite runner.
@@ -133,7 +133,7 @@ SDLTest_TestSuiteRunner * SDLTest_CreateTestSuiteRunner(SDLTest_CommonState *sta
*
* \param runner The runner that should be destroyed.
*/
-void SDLTest_DestroyTestSuiteRunner(SDLTest_TestSuiteRunner *runner);
+void SDLCALL SDLTest_DestroyTestSuiteRunner(SDLTest_TestSuiteRunner *runner);
/*
* Execute a test suite, using the configured run seed, execution key, filter, etc.
@@ -142,8 +142,7 @@ void SDLTest_DestroyTestSuiteRunner(SDLTest_TestSuiteRunner *runner);
*
* \returns the test run result: 0 when all tests passed, 1 if any tests failed.
*/
-int SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner);
-
+int SDLCALL SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_log.h b/include/SDL3/SDL_test_log.h
index d0aaf340a7083..6618217ce4210 100644
--- a/include/SDL3/SDL_test_log.h
+++ b/include/SDL3/SDL_test_log.h
@@ -49,14 +49,14 @@ extern "C" {
*
* \param fmt Message to be logged
*/
-void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+void SDLCALL SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/**
* Prints given message with a timestamp in the TEST category and the ERROR priority.
*
* \param fmt Message to be logged
*/
-void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+void SDLCALL SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_md5.h b/include/SDL3/SDL_test_md5.h
index 81d601df84390..d4d0bff985d45 100644
--- a/include/SDL3/SDL_test_md5.h
+++ b/include/SDL3/SDL_test_md5.h
@@ -88,8 +88,7 @@ extern "C" {
* mdContext. Call before each new use of the context -
* all fields are set to zero.
*/
- void SDLTest_Md5Init(SDLTest_Md5Context *mdContext);
-
+void SDLCALL SDLTest_Md5Init(SDLTest_Md5Context *mdContext);
/**
* update digest from variable length data
@@ -101,9 +100,8 @@ extern "C" {
* Note: The function updates the message-digest context to account
* for the presence of each of the characters inBuf[0..inLen-1]
* in the message whose digest is being computed.
-*/
-
- void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf,
+ */
+void SDLCALL SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf,
unsigned int inLen);
@@ -115,10 +113,8 @@ extern "C" {
* Note: The function terminates the message-digest computation and
* ends with the desired message digest in mdContext.digest[0..15].
* Always call before using the digest[] variable.
-*/
-
- void SDLTest_Md5Final(SDLTest_Md5Context *mdContext);
-
+ */
+void SDLCALL SDLTest_Md5Final(SDLTest_Md5Context *mdContext);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL3/SDL_test_memory.h b/include/SDL3/SDL_test_memory.h
index 8e22ed3a609ad..a1f8b1b3c0d53 100644
--- a/include/SDL3/SDL_test_memory.h
+++ b/include/SDL3/SDL_test_memory.h
@@ -36,28 +36,26 @@
extern "C" {
#endif
-
/**
* Start tracking SDL memory allocations
*
* \note This should be called before any other SDL functions for complete tracking coverage
*/
-void SDLTest_TrackAllocations(void);
+void SDLCALL SDLTest_TrackAllocations(void);
/**
* Fill allocations with random data
*
* \note This implicitly calls SDLTest_TrackAllocations()
*/
-void SDLTest_RandFillAllocations(void);
+void SDLCALL SDLTest_RandFillAllocations(void);
/**
* Print a log of any outstanding allocations
*
* \note This can be called after SDL_Quit()
*/
-void SDLTest_LogAllocations(void);
-
+void SDLCALL SDLTest_LogAllocations(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index e749e5c17bd5d..7b142e2b7afa0 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -99,7 +99,7 @@ static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL
va_end(ap);
}
-static void SDLTest_CommonArgParserFinalize(void *data)
+static void SDLCALL SDLTest_CommonArgParserFinalize(void *data)
{
SDLTest_CommonState *state = data;
@@ -120,7 +120,7 @@ static void SDLTest_CommonArgParserFinalize(void *data)
} \
*(dim)++ = '\0';
-static int SDLTest_CommonStateParseCommonArguments(void *data, char **argv, int index)
+static int SDLCALL SDLTest_CommonStateParseCommonArguments(void *data, char **argv, int index)
{
SDLTest_CommonState *state = data;
@@ -212,7 +212,7 @@ static int SDLTest_CommonStateParseCommonArguments(void *data, char **argv, int
return 0;
}
-static int SDLTest_CommonStateParseVideoArguments(void *data, char **argv, int index)
+static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **argv, int index)
{
SDLTest_CommonState *state = data;
@@ -593,7 +593,7 @@ static int SDLTest_CommonStateParseVideoArguments(void *data, char **argv, int i
return 0;
}
-static int SDLTest_CommonStateParseAudioArguments(void *data, char **argv, int index)
+static int SDLCALL SDLTest_CommonStateParseAudioArguments(void *data, char **argv, int index)
{
SDLTest_CommonState *state = data;
@@ -1971,7 +1971,7 @@ typedef struct
size_t size;
} SDLTest_ClipboardData;
-static void SDLTest_ScreenShotClipboardCleanup(void *context)
+static void SDLCALL SDLTest_ScreenShotClipboardCleanup(void *context)
{
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
@@ -1983,7 +1983,7 @@ static void SDLTest_ScreenShotClipboardCleanup(void *context)
SDL_free(data);
}
-static const void *SDLTest_ScreenShotClipboardProvider(void *context, const char *mime_type, size_t *size)
+static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, const char *mime_type, size_t *size)
{
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 6136e0299e917..c4eec36727725 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -792,7 +792,7 @@ int SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner)
return runResult;
}
-static int SDLTest_TestSuiteCommonArg(void *data, char **argv, int index)
+static int SDLCALL SDLTest_TestSuiteCommonArg(void *data, char **argv, int index)
{
SDLTest_TestSuiteRunner *runner
(Patch may be truncated, please check the link at the top of this post.)