diff --git a/src/OSspecific/POSIX/Make/files b/src/OSspecific/POSIX/Make/files index 44ba1ec1bfba3ab75cec382ccf8a3e7116a411a0..ce684dc46bc76fa65a43b70edde5e17cb7b293b7 100644 --- a/src/OSspecific/POSIX/Make/files +++ b/src/OSspecific/POSIX/Make/files @@ -20,7 +20,7 @@ POSIX.C */ fileMonitor.C -#ifdef SunOS64 +#ifdef __sun__ dummyPrintStack.C #else printStack.C diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 811eafe7e5c47b9a7225a03444e1afe91317f9bb..33d9a61679e112bf7186e536ce7bbeac615d29b0 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -28,7 +28,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifdef solarisGcc +#if defined(__sun__) && defined(__GNUC__) + // Not certain if this is still required #define _SYS_VNODE_H #endif @@ -59,7 +60,7 @@ Description #include <netinet/in.h> #include <dlfcn.h> -#ifdef darwin +#ifdef __APPLE__ #include <mach-o/dyld.h> #else @@ -1660,7 +1661,7 @@ void* Foam::dlOpen(const fileName& libName, const bool check) } void* handle = ::dlopen(libName.c_str(), RTLD_LAZY|RTLD_GLOBAL); - #ifdef darwin + #ifdef __APPLE__ // Re-try "libXX.so" as "libXX.dylib" if (!handle && libName.hasExt("so")) { @@ -1753,7 +1754,7 @@ bool Foam::dlSymFound(void* handle, const std::string& symbol) } -#ifndef darwin +#ifndef __APPLE__ static int collectLibsCallback ( struct dl_phdr_info *info, @@ -1772,7 +1773,7 @@ static int collectLibsCallback Foam::fileNameList Foam::dlLoaded() { DynamicList<fileName> libs; - #ifdef darwin + #ifdef __APPLE__ for (uint32_t i=0; i < _dyld_image_count(); ++i) { libs.append(_dyld_get_image_name(i)); diff --git a/src/OSspecific/POSIX/fileStat.C b/src/OSspecific/POSIX/fileStat.C index c3a118ba5bbe9d51c4657f572696938617cfc9bd..4337d1dac418902c9265f48ecc4f072a3057f054 100644 --- a/src/OSspecific/POSIX/fileStat.C +++ b/src/OSspecific/POSIX/fileStat.C @@ -30,7 +30,7 @@ License #include "timer.H" #include <unistd.h> -#ifndef darwin +#ifndef __APPLE__ #include <sys/sysmacros.h> #endif @@ -115,7 +115,7 @@ double Foam::fileStat::dmodTime() const ( valid_ ? - #ifdef darwin + #ifdef __APPLE__ (status_.st_mtime + 1e-9*status_.st_mtimespec.tv_nsec) #else (status_.st_mtime + 1e-9*status_.st_mtim.tv_nsec) diff --git a/src/OSspecific/POSIX/printStack.C b/src/OSspecific/POSIX/printStack.C index 48850442eeed99833d799ec23e26897add8690ad..a6dea3d6216cbc257c9a97a1669ddfe961c074e4 100644 --- a/src/OSspecific/POSIX/printStack.C +++ b/src/OSspecific/POSIX/printStack.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -89,7 +89,7 @@ string pOpen(const string& cmd, label line=0) inline word addressToWord(const uintptr_t addr) { OStringStream os; - #ifdef darwin + #ifdef __APPLE__ os << "0x" << hex << uint64_t(addr); #else os << "0x" << hex << addr; @@ -121,7 +121,7 @@ void printSourceFileAndLine // Darwin addr2line implementation. // On other systems (Linux), only use relative addresses for libraries. - #ifndef darwin + #ifndef __APPLE__ if (filename.hasExt("so")) #endif { diff --git a/src/OSspecific/POSIX/signals/feexceptErsatz.H b/src/OSspecific/POSIX/signals/feexceptErsatz.H index 1b866242f2d86204c29f84837c4c6c41f08a277b..ee6548b773d323f965da3ff36c4d09051262a676 100644 --- a/src/OSspecific/POSIX/signals/feexceptErsatz.H +++ b/src/OSspecific/POSIX/signals/feexceptErsatz.H @@ -20,8 +20,8 @@ #ifndef feexceptErsatz_H #define feexceptErsatz_H -#ifdef darwin +#ifdef __APPLE__ #include <fenv.h> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,7 +68,7 @@ inline int fedisableexcept(unsigned int excepts) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#endif // darwin +#endif // __APPLE__ #endif // ************************************************************************* // diff --git a/src/OSspecific/POSIX/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C index 048805307e5a8119c86c4a28a79fa1ef2f156e41..c2c54d65abc94a155f41cc255f478f323c08374b 100644 --- a/src/OSspecific/POSIX/signals/sigFpe.C +++ b/src/OSspecific/POSIX/signals/sigFpe.C @@ -43,7 +43,7 @@ License #include <malloc.h> #endif -#ifdef darwin +#ifdef __APPLE__ #include "feexceptErsatz.H" #endif @@ -121,7 +121,7 @@ void* Foam::sigFpe::mallocNan(size_t size) void Foam::sigFpe::sigHandler(int) { - #if (defined(__linux__) && defined(__GNUC__)) || defined(darwin) + #if (defined(__linux__) && defined(__GNUC__)) || defined(__APPLE__) resetHandler("SIGFPE", SIGFPE); @@ -129,7 +129,7 @@ void Foam::sigFpe::sigHandler(int) error::printStack(Perr); ::raise(SIGFPE); // Throw signal (to old handler) - #endif // (__linux__ && __GNUC__) || darwin + #endif // (__linux__ && __GNUC__) || __APPLE__ } @@ -188,7 +188,7 @@ void Foam::sigFpe::set(bool verbose) { if (!sigActive_ && requested()) { - #if (defined(__linux__) && defined(__GNUC__)) || defined(darwin) + #if (defined(__linux__) && defined(__GNUC__)) || defined(__APPLE__) feenableexcept ( @@ -244,7 +244,7 @@ void Foam::sigFpe::set(bool verbose) void Foam::sigFpe::unset(bool verbose) { - #if (defined(__linux__) && defined(__GNUC__)) || defined(darwin) + #if (defined(__linux__) && defined(__GNUC__)) || defined(__APPLE__) if (sigActive_) { if (verbose) diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index c8e4ceaa3129eeffbb241f5e46faa3a07b6580e0..7e63d8d298d264046e5af2bd8eebec69853727bd 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011, 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -319,7 +319,7 @@ Foam::fileName Foam::dynamicCode::codeRelPath() const Foam::fileName Foam::dynamicCode::libRelPath() const { - #ifdef darwin + #ifdef __APPLE__ return codeRelPath()/libSubDir_/"lib" + codeName_ + ".dylib"; #else return codeRelPath()/libSubDir_/"lib" + codeName_ + ".so"; diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H index ded00d65627253dd0232767b99a9c320cc74cd33..4ed7ffaf3cc2228511552e63591a0a84e23bb698 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011 OpenFOAM Foundation @@ -223,7 +223,7 @@ public: // Corresponds to codeRoot()/libSubDir()/lib\<codeName\>.so fileName libPath() const { - #ifdef darwin + #ifdef __APPLE__ return codeRoot_/libSubDir_/"lib" + codeName_ + ".dylib"; #else return codeRoot_/libSubDir_/"lib" + codeName_ + ".so"; diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H index dca0fc152dbf8870dc646f9a51e009d3c4a55759..bc90a1c7df9ea8d53a7cd9b973305e7b1041b0d6 100644 --- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H +++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H @@ -109,6 +109,18 @@ inline Scalar func(const Scalar s) \ std::cerr<< "No '" << #func << "' function\n"; \ return 0; \ } +#elif defined(__MINGW32__) + // Mingw: with '_' prefix + #define besselFunc(func) \ + inline Scalar func(const Scalar s) \ + { \ + return _##func(s); \ + } + #define besselFunc2(func) \ + inline Scalar func(const int n, const Scalar s) \ + { \ + return _##func(n, s); \ + } #else #define besselFunc(func) \ inline Scalar func(const Scalar s) \ @@ -122,6 +134,7 @@ inline Scalar func(const Scalar s) \ } #endif + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H index 0304106021397f9d351283bf3e62b8ad42ae0a6f..5e09ae9516bf56aca2c32f96d8265848c057552f 100644 --- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H +++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H @@ -109,8 +109,8 @@ inline Scalar func(const Scalar s) \ std::cerr<< "No '" << #func << "' function\n"; \ return 0; \ } -#elif defined(darwin) - // No float version for darwin - use a cast. +#elif defined(__APPLE__) + // Darwin: no float version (use a cast) #define besselFunc(func) \ inline Scalar func(const Scalar s) \ { \ @@ -121,7 +121,18 @@ inline Scalar func(const Scalar s) \ { \ return Scalar(::func(n, double(s))); \ } - +#elif defined(__MINGW32__) + // Mingw: with '_' prefix, no float version (use a cast) + #define besselFunc(func) \ + inline Scalar func(const Scalar s) \ + { \ + return _##func(s); \ + } + #define besselFunc2(func) \ + inline Scalar func(const int n, const Scalar s) \ + { \ + return Scalar(_##func(n, double(s))); \ + } #else // With 'f' (float) appended to the name #define besselFunc(func) \ diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 4027f8632817cd282c62956d69625214533c1252..b0e075b6346658ce7f4c0c5ad851172e883b3018 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2014-2016 OpenFOAM Foundation @@ -46,7 +46,6 @@ SourceFiles #include "pTraits.H" #include "direction.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -120,9 +119,10 @@ inline bool read(const std::string& str, int64_t& val) Istream& operator>>(Istream& is, int64_t& val); Ostream& operator<<(Ostream& os, const int64_t val); -// On Darwin: long is not unambiguously (int32_t | int64_t) +// On Darwin and Windows (mingw): +// long is not unambiguously (int32_t | int64_t) // - explicitly resolve for input and output -#ifdef darwin +#if defined(__APPLE__) || defined(_WIN32) Istream& operator>>(Istream& is, long& val); Ostream& operator<<(Ostream& os, const long val); #endif diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C index 47e7a97ab62a2ae7ad9870010bef3f082de4d00d..add4abb45528f7a603f5ad37cdc8f1753c4051e4 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64IO.C +++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2014-2016 OpenFOAM Foundation @@ -125,7 +125,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t val) } -#ifdef darwin +#if defined(__APPLE__) || defined(_WIN32) Foam::Istream& Foam::operator>>(Istream& is, long& val) { return operator>>(is, reinterpret_cast<int64_t&>(val)); diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H index 694e9f1158749f4b2b051a983cda1be84d43e9f5..7b2da34766a6d1060d9b42282581458bc221893c 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64.H +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2014-2016 OpenFOAM Foundation @@ -119,9 +119,10 @@ inline bool read(const std::string& str, uint64_t& val) Istream& operator>>(Istream& is, uint64_t& val); Ostream& operator<<(Ostream& os, const uint64_t val); -// On Darwin: unsigned long is not unambiguously (uint32_t | uint64_t) +// On Darwin: +// unsigned long is not unambiguously (uint32_t | uint64_t) // - explicitly resolve for output -#ifdef darwin +#ifdef __APPLE__ Ostream& operator<<(Ostream& os, const unsigned long val); #endif diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C index e6e8369025ac893bf5e5342ce6677b6d8e189e85..38b4e0c9db0be0e49a56964a1e17b450cdfd06ce 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C +++ b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2014-2016 OpenFOAM Foundation @@ -124,7 +124,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const uint64_t val) } -#ifdef darwin +#ifdef __APPLE__ Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned long val) { os << uint64_t(val); diff --git a/wmake/rules/General/general b/wmake/rules/General/general index ec52419e9d571983818e4528615d40d319404ddd..4eb70d6c451ab5a751c362deeaaeb695e5358c47 100644 --- a/wmake/rules/General/general +++ b/wmake/rules/General/general @@ -7,7 +7,7 @@ RANLIB = ranlib CPP = cpp LD = ld -GFLAGS = -D$(WM_VERSION) -D$(WM_ARCH) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \ +GFLAGS = -D$(WM_VERSION) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \ -DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE) GINC = GLIBS = -lm diff --git a/wmake/rules/darwin64Clang/general b/wmake/rules/darwin64Clang/general index 37bf4f300e7314421595a2f22d664034e90e7889..1409ef1e6e96f6772cacec47c4774b3e306fc58b 100644 --- a/wmake/rules/darwin64Clang/general +++ b/wmake/rules/darwin64Clang/general @@ -1,4 +1,4 @@ -CPP = cpp -traditional-cpp $(GFLAGS) -Ddarwin +CPP = cpp -traditional-cpp $(GFLAGS) PROJECT_LIBS = -l$(WM_PROJECT) -ldl @@ -11,7 +11,4 @@ include $(DEFAULT_RULES)/c++ # Shared library extension (with '.' separator) EXT_SO = .dylib -# Define general os-type -GFLAGS += -Ddarwin - # -----------------------------------------------------------------------------