Skip to content

Commit

Permalink
workaround the brokenness with Watcom builds and SDL math functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Mar 15, 2021
1 parent cd752f6 commit d136a5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/SDL_sound_shn.c
Expand Up @@ -174,6 +174,10 @@ static const Uint8 ulaw_outward[13][256] = {
#define M_PI 3.14159265358979323846
#endif

#if defined(HAVE_LIBC) && defined(__WATCOMC__) /* Watcom has issues... */
#define SDL_log log
#endif


static int word_get(shn_t *shn, SDL_RWops *rw, Uint32 *word)
{
Expand Down
6 changes: 4 additions & 2 deletions src/SDL_sound_vorbis.c
Expand Up @@ -48,8 +48,6 @@
#define memcmp SDL_memcmp
#define memcpy SDL_memcpy
#define qsort SDL_qsort
#define pow SDL_pow
#define floor SDL_floor
#define malloc SDL_malloc
#define realloc SDL_realloc
#define free SDL_free
Expand All @@ -59,12 +57,16 @@
#endif
#define alloca(x) ((void *) SDL_stack_alloc(Uint8, (x)))
*/
#if !(defined(HAVE_LIBC) && defined(__WATCOMC__)) /* Watcom has issues... */
#define pow SDL_pow
#define floor SDL_floor
#define ldexp(v, e) SDL_scalbn((v), (e))
#define abs(x) SDL_abs(x)
#define cos(x) SDL_cos(x)
#define sin(x) SDL_sin(x)
#define log(x) SDL_log(x)
#endif
#endif
#include "stb_vorbis.h"

static const char *vorbis_error_string(const int err)
Expand Down
10 changes: 10 additions & 0 deletions src/libmodplug/libmodplug.h
Expand Up @@ -11,6 +11,16 @@

#include "SDL.h"

#if defined(HAVE_LIBC) && defined(__WATCOMC__) /* Watcom has issues... */
#define SDL_cos cos
#define SDL_fabs fabs
#define SDL_log log
#define SDL_pow pow
#define SDL_sin sin
#define SDL_sinf sin
#define SDL_abs abs
#endif

#if ((defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)) && !defined(_WIN32)
#pragma GCC visibility push(hidden)
#endif
Expand Down

0 comments on commit d136a5c

Please sign in to comment.