Removed the inline functions from SDL_stdinc.h

Having the SDL functions inline is causing build issues, and in the case of malloc(), etc. causing malloc/free mismatches, if the application build environment differs from the SDL build environment.

In the interest of safety and consistency, the functions will always be in the SDL library and will only be redirected to the C library there, if they are available.

See the following threads on the SDL mailing list for the gruesome details:
* SDL_stdinc.h inlines problematic when application not compiled in exact same feature environment
* Error compiling program against SDL2 with -std=c++11 g++ flag
This commit is contained in:
Sam Lantinga 2013-07-05 23:57:19 -07:00
parent 3a78485f2d
commit cfd541e89c
9 changed files with 469 additions and 788 deletions

View file

@ -18,74 +18,19 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#include "SDL_stdinc.h"
/* Math routines from uClibc: http://www.uclibc.org */
#ifdef HAVE_ATAN
#define atan SDL_uclibc_atan
#else
#define atan SDL_atan
#endif
double atan(double x);
#ifndef HAVE_ATAN2
#define __ieee754_atan2 SDL_atan2
#endif
#ifdef HAVE_COPYSIGN
#define copysign SDL_uclibc_copysign
#else
#define copysign SDL_copysign
#endif
double copysign(double x, double y);
#ifdef HAVE_COS
#define cos SDL_uclibc_cos
#else
#define cos SDL_cos
#endif
double cos(double x);
#ifdef HAVE_FABS
#define fabs SDL_uclibc_fabs
#else
#define fabs SDL_fabs
#endif
double fabs(double x);
#ifdef HAVE_FLOOR
#define floor SDL_uclibc_floor
#else
#define floor SDL_floor
#endif
double floor(double x);
#ifndef HAVE_LOG
#define __ieee754_log SDL_log
#endif
#ifndef HAVE_POW
#define __ieee754_pow SDL_pow
#endif
#ifdef HAVE_SCALBN
#define scalbn SDL_uclibc_scalbn
#else
#define scalbn SDL_scalbn
#endif
double scalbn(double x, int n);
#ifdef HAVE_SIN
#define sin SDL_uclibc_sin
#else
#define sin SDL_sin
#endif
double sin(double x);
#ifndef HAVE_SQRT
#define __ieee754_sqrt SDL_sqrt
#endif
double SDL_uclibc_atan(double x);
double SDL_uclibc_atan2(double y, double x);
double SDL_uclibc_copysign(double x, double y);
double SDL_uclibc_cos(double x);
double SDL_uclibc_fabs(double x);
double SDL_uclibc_floor(double x);
double SDL_uclibc_log(double x);
double SDL_uclibc_pow(double x, double y);
double SDL_uclibc_scalbn(double x, int n);
double SDL_uclibc_sin(double x);
double SDL_uclibc_sqrt(double x);
/* vi: set ts=4 sw=4 expandtab: */