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"
|
#include "base/Profiler.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#include "system/sysutils.h"
|
||||||
#include <alloca.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|||||||
@@ -33,10 +33,7 @@
|
|||||||
#include "dsp/Resampler.h"
|
#include "dsp/Resampler.h"
|
||||||
#include "base/Profiler.h"
|
#include "base/Profiler.h"
|
||||||
#include "system/VectorOps.h"
|
#include "system/VectorOps.h"
|
||||||
|
#include "system/sysutils.h"
|
||||||
#ifndef _WIN32
|
|
||||||
#include <alloca.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|||||||
@@ -43,19 +43,26 @@
|
|||||||
# define R__
|
# define R__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined(__MSVC__)
|
||||||
#include <malloc.h>
|
|
||||||
#else
|
|
||||||
#ifndef __MSVC__
|
|
||||||
#include <alloca.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __MSVC__
|
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
# define alloca _alloca
|
# define alloca _alloca
|
||||||
# define getpid _getpid
|
# 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
|
#endif
|
||||||
|
|
||||||
#if defined(__MSVC__) && _MSC_VER < 1700
|
#if defined(__MSVC__) && _MSC_VER < 1700
|
||||||
@@ -82,24 +89,20 @@ enum ProcessStatus { ProcessRunning, ProcessNotRunning, UnknownProcessStatus };
|
|||||||
extern ProcessStatus system_get_process_status(int pid);
|
extern ProcessStatus system_get_process_status(int pid);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
struct timeval { long tv_sec; long tv_usec; };
|
struct timeval { long tv_sec; long tv_usec; };
|
||||||
void gettimeofday(struct timeval *p, void *tz);
|
void gettimeofday(struct timeval *p, void *tz);
|
||||||
|
#endif // _WIN32
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __MSVC__
|
#ifdef __MSVC__
|
||||||
|
|
||||||
void usleep(unsigned long);
|
void usleep(unsigned long);
|
||||||
|
#endif // __MSVC__
|
||||||
#endif
|
|
||||||
|
|
||||||
inline double mod(double x, double y) { return x - (y * floor(x / y)); }
|
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))); }
|
inline float modf(float x, float y) { return x - (y * float(floor(x / y))); }
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#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 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; }
|
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 DLCLOSE(a) FreeLibrary((HINSTANCE)(a))
|
||||||
#define DLERROR() ""
|
#define DLERROR() ""
|
||||||
|
|
||||||
#else
|
#else // !_WIN32
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@@ -157,11 +160,12 @@ extern void system_memorybarrier();
|
|||||||
#define DLCLOSE(a) dlclose((a))
|
#define DLCLOSE(a) dlclose((a))
|
||||||
#define DLERROR() dlerror()
|
#define DLERROR() dlerror()
|
||||||
|
|
||||||
#endif
|
#endif // !_WIN32
|
||||||
|
|
||||||
#ifdef NO_THREADING
|
#ifdef NO_THREADING
|
||||||
# undef MBARRIER
|
# undef MBARRIER
|
||||||
# define MBARRIER()
|
# define MBARRIER()
|
||||||
#endif
|
#endif // NO_THREADING
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user