Adjustments for macOS

This commit is contained in:
Martin Beaudoin 2018-02-21 20:52:04 -05:00
parent 4e8acd1fbf
commit a1bf12effe
5 changed files with 40 additions and 1 deletions

View file

@ -52,7 +52,10 @@ Description
#include <sys/socket.h>
#include <netdb.h>
#include <dlfcn.h>
#ifndef darwin
#include <link.h>
#endif
#include <netinet/in.h>

View file

@ -262,7 +262,7 @@ void Foam::sigFpe::set(const bool verbose)
# elif defined(__APPLE__)
struct sigaction newAction;
newAction.sa_handler = sigFpeHandler;
newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask);
if (sigaction(SIGFPE, &newAction, &oldAction_) < 0)

View file

@ -31,6 +31,25 @@ License
#include <cmath>
#if defined(darwin) && defined(__clang__)
#ifndef DUMMY_SCALAR_FUNCTIONS
#define DUMMY_SCALAR_FUNCTIONS
inline float j0f(float x) { return float(j0(double(x)));}
inline float j1f(float x) { return float(j1(double(x)));}
inline float y0f(float x) { return float(y0(double(x)));}
inline float y1f(float x) { return float(y1(double(x)));}
inline float jnf(const int n, const float s) { return float(jn(n, double(s))); }
inline float ynf(const int n, const float s) { return float(yn(n, double(s))); }
inline long double j0l(float x) { return double(j0(double(x)));}
inline long double j1l(float x) { return double(j1(double(x)));}
inline long double y0l(float x) { return double(y0(double(x)));}
inline long double y1l(float x) { return double(y1(double(x)));}
inline long double jnl(const int n, const float s) { return double(jn(n, double(s))); }
inline long double ynl(const int n, const float s) { return double(yn(n, double(s))); }
#endif
#endif // darwin
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam

View file

@ -69,6 +69,11 @@ bool read(const char*, int64_t&);
Istream& operator>>(Istream&, int64_t&);
Ostream& operator<<(Ostream&, const int64_t);
#if WM_ARCH_OPTION == 64 && darwin && __clang__
Istream& operator>>(Istream&, long&);
Ostream& operator<<(Ostream&, const long);
#endif
//- Template specialization for pTraits<int64_t>
template<>
class pTraits<int64_t>

View file

@ -101,5 +101,17 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t i)
return os;
}
#if WM_ARCH_OPTION == 64 && darwin && __clang__
Foam::Istream& Foam::operator>>(Istream& is, long& i)
{
return operator>>(is, reinterpret_cast<int64_t&>(i));
}
Foam::Ostream& Foam::operator<<(Ostream& os, const long i)
{
os << int64_t(i);
return os;
}
#endif
// ************************************************************************* //