13
0

Modify 'ardourext/misc.h' so that it only uses C++ constructs when the compilation is cplusplus

This commit is contained in:
John Emmas 2013-08-27 17:10:46 +01:00
parent 909fcf4b2d
commit 9b6687ff3f

View File

@ -27,7 +27,10 @@
#define _CPP_VECTOR 1 #define _CPP_VECTOR 1
#endif #endif
#ifdef __cplusplus
#include <vector> #include <vector>
#endif
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include <direct.h> #include <direct.h>
@ -171,7 +174,11 @@ typedef int register_t;
// throw() // throw()
#ifndef __THROW #ifndef __THROW
#ifdef __cplusplus
#define __THROW throw() #define __THROW throw()
#else
#define __THROW
#endif
#endif #endif
// round().... Unlike Linux, Windows doesn't seem to support the // round().... Unlike Linux, Windows doesn't seem to support the
@ -198,6 +205,7 @@ typedef _mode_t mode_t;
#endif /* _MODE_T_ */ #endif /* _MODE_T_ */
// int64 abs() // int64 abs()
#ifdef __cplusplus // Normal 'C' doesn't permit over-ridden functions !!
inline uint64_t abs(int64_t val) inline uint64_t abs(int64_t val)
{ {
if (val < 0) if (val < 0)
@ -205,6 +213,7 @@ inline uint64_t abs(int64_t val)
else else
return val; return val;
} }
#endif
// fmin() and fmax() // fmin() and fmax()
#define fmin(a, b) min((double)a, (double)b) #define fmin(a, b) min((double)a, (double)b)
@ -221,6 +230,7 @@ inline uint64_t abs(int64_t val)
// #include the main headers for Ardour MSVC // #include the main headers for Ardour MSVC
#ifdef __cplusplus
#if defined(BUILDING_PBD) || defined(PBD_IS_IN_WIN_STATIC_LIB) #if defined(BUILDING_PBD) || defined(PBD_IS_IN_WIN_STATIC_LIB)
#include <pbd/msvc_pbd.h> #include <pbd/msvc_pbd.h>
#endif #endif
@ -230,5 +240,6 @@ inline uint64_t abs(int64_t val)
#if defined(BUILDING_RUBBERBAND) || defined(RUBBERBAND_IS_IN_WIN_STATIC_LIB) #if defined(BUILDING_RUBBERBAND) || defined(RUBBERBAND_IS_IN_WIN_STATIC_LIB)
#include <rubberband/msvc_rubberband.h> #include <rubberband/msvc_rubberband.h>
#endif #endif
#endif // __cplusplus
#endif /* __ardour_msvc_extensions_h__ */ #endif /* __ardour_msvc_extensions_h__ */