From a4c8aa5e02277cab252e6b9379404b3c792e7e89 Mon Sep 17 00:00:00 2001 From: Niadb <34917535+Niadb@users.noreply.github.com> Date: Fri, 19 Jun 2020 03:31:47 -0600 Subject: [PATCH 1/5] Add files via upload --- lib/common/compiler.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 95e948352..825f01d80 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -27,6 +27,7 @@ # define FORCE_INLINE_ATTR __attribute__((always_inline)) #elif defined(_MSC_VER) # define FORCE_INLINE_ATTR __forceinline + #else # define FORCE_INLINE_ATTR #endif @@ -38,6 +39,12 @@ #endif +#if defined(_MSC_VER) +# define WIN_CDECL __cdecl +#else +# define WIN_CDECL +#endif + /** * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant * parameters. They must be inlined for the compiler to eliminate the constant From 405586d40a46a7c741bae1a6bd10e5f187174a25 Mon Sep 17 00:00:00 2001 From: Niadb <34917535+Niadb@users.noreply.github.com> Date: Fri, 19 Jun 2020 03:32:11 -0600 Subject: [PATCH 2/5] Add files via upload --- lib/dictBuilder/cover.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dictBuilder/cover.c b/lib/dictBuilder/cover.c index da54ef15f..dac4e1422 100644 --- a/lib/dictBuilder/cover.c +++ b/lib/dictBuilder/cover.c @@ -261,7 +261,7 @@ static int COVER_cmp8(COVER_ctx_t *ctx, const void *lp, const void *rp) { * NOTE: g_ctx must be set to call this function. A global is required because * qsort doesn't take an opaque pointer. */ -static int COVER_strict_cmp(const void *lp, const void *rp) { +static int WIN_CDECL COVER_strict_cmp(const void *lp, const void *rp) { int result = COVER_cmp(g_ctx, lp, rp); if (result == 0) { result = lp < rp ? -1 : 1; @@ -271,7 +271,7 @@ static int COVER_strict_cmp(const void *lp, const void *rp) { /** * Faster version for d <= 8. */ -static int COVER_strict_cmp8(const void *lp, const void *rp) { +static int WIN_CDECL COVER_strict_cmp8(const void *lp, const void *rp) { int result = COVER_cmp8(g_ctx, lp, rp); if (result == 0) { result = lp < rp ? -1 : 1; From 2962fda93f9cdd52724d76c43bb67e08c021e4d4 Mon Sep 17 00:00:00 2001 From: Niadb <34917535+Niadb@users.noreply.github.com> Date: Fri, 19 Jun 2020 03:34:05 -0600 Subject: [PATCH 3/5] Add files via upload --- lib/common/compiler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 825f01d80..781ee4351 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -27,7 +27,6 @@ # define FORCE_INLINE_ATTR __attribute__((always_inline)) #elif defined(_MSC_VER) # define FORCE_INLINE_ATTR __forceinline - #else # define FORCE_INLINE_ATTR #endif From 8c115cbe234decc9c05b7f8215a2201639aa5c2e Mon Sep 17 00:00:00 2001 From: Niadb <34917535+Niadb@users.noreply.github.com> Date: Fri, 19 Jun 2020 09:48:35 -0600 Subject: [PATCH 4/5] Update compiler.h Added a comment explaining the purpose of the WIN_CDECL macro --- lib/common/compiler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 781ee4351..91bd85e43 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -38,6 +38,11 @@ #endif +/** + On MSVC qsort requires functions passed to it use the __cdecl calling conversion(CC). + This explictly marks such functions as __cdecl so that the code will still compile + if a CC other than __cdecl has been made the default. +*/ #if defined(_MSC_VER) # define WIN_CDECL __cdecl #else From 74f65f624c2c118af7eacf9ad9b159e11ab59218 Mon Sep 17 00:00:00 2001 From: Niadb <34917535+Niadb@users.noreply.github.com> Date: Fri, 19 Jun 2020 09:51:00 -0600 Subject: [PATCH 5/5] Update compiler.h clean wording --- lib/common/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 91bd85e43..37cdc45eb 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -39,7 +39,7 @@ #endif /** - On MSVC qsort requires functions passed to it use the __cdecl calling conversion(CC). + On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC). This explictly marks such functions as __cdecl so that the code will still compile if a CC other than __cdecl has been made the default. */