Rejig includes for alloca in particular - more logic in sysutils, remove from individual files (include sysutils instead), also indent includes in sysutils for a bit more clarity
This commit is contained in:
@@ -37,9 +37,7 @@
|
||||
|
||||
#include "base/Profiler.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include "system/sysutils.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
@@ -33,10 +33,7 @@
|
||||
#include "dsp/Resampler.h"
|
||||
#include "base/Profiler.h"
|
||||
#include "system/VectorOps.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include "system/sysutils.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
@@ -43,19 +43,26 @@
|
||||
# define R__
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#ifndef __MSVC__
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __MSVC__
|
||||
#if defined(__MSVC__)
|
||||
# include <malloc.h>
|
||||
# include <process.h>
|
||||
# define alloca _alloca
|
||||
# define getpid _getpid
|
||||
#else
|
||||
# if defined(__MINGW32__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__GNUC__)
|
||||
# ifndef alloca
|
||||
# define alloca __builtin_alloca
|
||||
# endif
|
||||
# elif defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifndef __USE_MISC
|
||||
# define __USE_MISC
|
||||
# endif
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__MSVC__) && _MSC_VER < 1700
|
||||
@@ -82,24 +89,20 @@ enum ProcessStatus { ProcessRunning, ProcessNotRunning, UnknownProcessStatus };
|
||||
extern ProcessStatus system_get_process_status(int pid);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
struct timeval { long tv_sec; long tv_usec; };
|
||||
void gettimeofday(struct timeval *p, void *tz);
|
||||
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __MSVC__
|
||||
|
||||
void usleep(unsigned long);
|
||||
|
||||
#endif
|
||||
#endif // __MSVC__
|
||||
|
||||
inline double mod(double x, double y) { return x - (y * floor(x / y)); }
|
||||
inline float modf(float x, float y) { return x - (y * float(floor(x / y))); }
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
#endif // M_PI
|
||||
|
||||
inline double princarg(double a) { return mod(a + M_PI, -2.0 * M_PI) + M_PI; }
|
||||
inline float princargf(float a) { return modf(a + (float)M_PI, -2.f * (float)M_PI) + (float)M_PI; }
|
||||
@@ -124,7 +127,7 @@ extern void system_memorybarrier();
|
||||
#define DLCLOSE(a) FreeLibrary((HINSTANCE)(a))
|
||||
#define DLERROR() ""
|
||||
|
||||
#else
|
||||
#else // !_WIN32
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <dlfcn.h>
|
||||
@@ -157,11 +160,12 @@ extern void system_memorybarrier();
|
||||
#define DLCLOSE(a) dlclose((a))
|
||||
#define DLERROR() dlerror()
|
||||
|
||||
#endif
|
||||
#endif // !_WIN32
|
||||
|
||||
#ifdef NO_THREADING
|
||||
# undef MBARRIER
|
||||
# define MBARRIER()
|
||||
#endif
|
||||
#endif // NO_THREADING
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user