diff --git a/packages/belos/src/BelosBiCGStabSolMgr.hpp b/packages/belos/src/BelosBiCGStabSolMgr.hpp index 647a3ba08932..061e4bcd981a 100644 --- a/packages/belos/src/BelosBiCGStabSolMgr.hpp +++ b/packages/belos/src/BelosBiCGStabSolMgr.hpp @@ -272,7 +272,13 @@ namespace Belos { static constexpr int defQuorum_default_ = 1; static constexpr const char * resScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_,achievedTol_; diff --git a/packages/belos/src/BelosBlockCGSolMgr.hpp b/packages/belos/src/BelosBlockCGSolMgr.hpp index 486edfa18a6d..151e1a3c90ef 100644 --- a/packages/belos/src/BelosBlockCGSolMgr.hpp +++ b/packages/belos/src/BelosBlockCGSolMgr.hpp @@ -362,7 +362,13 @@ namespace Belos { static constexpr const char * label_default_ = "Belos"; static constexpr const char * orthoType_default_ = "ICGS"; static constexpr bool assertPositiveDefiniteness_default_ = true; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // // Current solver parameters and other values. diff --git a/packages/belos/src/BelosBlockGmresSolMgr.hpp b/packages/belos/src/BelosBlockGmresSolMgr.hpp index 00754540b721..ccb54ddfe9f8 100644 --- a/packages/belos/src/BelosBlockGmresSolMgr.hpp +++ b/packages/belos/src/BelosBlockGmresSolMgr.hpp @@ -332,7 +332,13 @@ class BlockGmresSolMgr : public SolverManager { static constexpr const char * expResScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; static constexpr const char * orthoType_default_ = "ICGS"; - static constexpr std::ostream * outputStream_default_ = &std::cout; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else + static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_, orthoKappa_, achievedTol_; diff --git a/packages/belos/src/BelosFixedPointSolMgr.hpp b/packages/belos/src/BelosFixedPointSolMgr.hpp index 72fbe3ec6880..eaed86b92833 100644 --- a/packages/belos/src/BelosFixedPointSolMgr.hpp +++ b/packages/belos/src/BelosFixedPointSolMgr.hpp @@ -285,7 +285,13 @@ namespace Belos { static constexpr int outputStyle_default_ = Belos::General; static constexpr int outputFreq_default_ = -1; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // // Current solver parameters and other values. diff --git a/packages/belos/src/BelosGCRODRSolMgr.hpp b/packages/belos/src/BelosGCRODRSolMgr.hpp index 10af2d81cf05..07843b26d7a4 100644 --- a/packages/belos/src/BelosGCRODRSolMgr.hpp +++ b/packages/belos/src/BelosGCRODRSolMgr.hpp @@ -470,7 +470,13 @@ Systems," SIAM Journal on Scientific Computing, 28(5), pp. 1651-1674, static constexpr const char * expResScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; static constexpr const char * orthoType_default_ = "ICGS"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convTol_, orthoKappa_, achievedTol_; diff --git a/packages/belos/src/BelosGmresPolyOp.hpp b/packages/belos/src/BelosGmresPolyOp.hpp index e00cf3754de5..73421f8b4737 100644 --- a/packages/belos/src/BelosGmresPolyOp.hpp +++ b/packages/belos/src/BelosGmresPolyOp.hpp @@ -302,7 +302,13 @@ namespace Belos { static constexpr const char * label_default_ = "Belos"; static constexpr const char * polyType_default_ = "Roots"; static constexpr const char * orthoType_default_ = "DGKS"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif static constexpr bool damp_default_ = false; static constexpr bool addRoots_default_ = true; diff --git a/packages/belos/src/BelosGmresPolySolMgr.hpp b/packages/belos/src/BelosGmresPolySolMgr.hpp index 59c0d4e7f73c..4bca876d932c 100644 --- a/packages/belos/src/BelosGmresPolySolMgr.hpp +++ b/packages/belos/src/BelosGmresPolySolMgr.hpp @@ -322,7 +322,13 @@ class GmresPolySolMgr : public SolverManager { static constexpr bool addRoots_default_ = true; static constexpr bool dampPoly_default_ = false; static constexpr bool randomRHS_default_ = true; - static constexpr std::ostream * outputStream_default_ = &std::cout; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else + static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType polyTol_; diff --git a/packages/belos/src/BelosPCPGSolMgr.hpp b/packages/belos/src/BelosPCPGSolMgr.hpp index faf2f87130ed..2f49381ffec8 100644 --- a/packages/belos/src/BelosPCPGSolMgr.hpp +++ b/packages/belos/src/BelosPCPGSolMgr.hpp @@ -377,7 +377,13 @@ namespace Belos { static constexpr int outputFreq_default_ = -1; static constexpr const char * label_default_ = "Belos"; static constexpr const char * orthoType_default_ = "ICGS"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // // Current solver values. diff --git a/packages/belos/src/BelosPseudoBlockCGSolMgr.hpp b/packages/belos/src/BelosPseudoBlockCGSolMgr.hpp index 4ec6b0ee49ea..874696379d40 100644 --- a/packages/belos/src/BelosPseudoBlockCGSolMgr.hpp +++ b/packages/belos/src/BelosPseudoBlockCGSolMgr.hpp @@ -339,7 +339,13 @@ namespace Belos { static constexpr bool foldConvergenceDetectionIntoAllreduce_default_ = false; static constexpr const char * resScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif static constexpr bool genCondEst_default_ = false; // Current solver values. diff --git a/packages/belos/src/BelosPseudoBlockGmresSolMgr.hpp b/packages/belos/src/BelosPseudoBlockGmresSolMgr.hpp index 4772885ef065..392032edf601 100644 --- a/packages/belos/src/BelosPseudoBlockGmresSolMgr.hpp +++ b/packages/belos/src/BelosPseudoBlockGmresSolMgr.hpp @@ -501,7 +501,13 @@ namespace Belos { static constexpr const char * expResScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; static constexpr const char * orthoType_default_ = "ICGS"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_, orthoKappa_, achievedTol_; diff --git a/packages/belos/src/BelosPseudoBlockStochasticCGSolMgr.hpp b/packages/belos/src/BelosPseudoBlockStochasticCGSolMgr.hpp index ce9324907824..24c685802ae9 100644 --- a/packages/belos/src/BelosPseudoBlockStochasticCGSolMgr.hpp +++ b/packages/belos/src/BelosPseudoBlockStochasticCGSolMgr.hpp @@ -255,7 +255,13 @@ namespace Belos { static constexpr int defQuorum_default_ = 1; static constexpr const char * resScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_; diff --git a/packages/belos/src/BelosPseudoBlockTFQMRSolMgr.hpp b/packages/belos/src/BelosPseudoBlockTFQMRSolMgr.hpp index cd2099a3d7e3..69be86a4100e 100644 --- a/packages/belos/src/BelosPseudoBlockTFQMRSolMgr.hpp +++ b/packages/belos/src/BelosPseudoBlockTFQMRSolMgr.hpp @@ -270,7 +270,13 @@ namespace Belos { static constexpr const char * impResScale_default_ = "Norm of Preconditioned Initial Residual"; static constexpr const char * expResScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_, impTolScale_, achievedTol_; diff --git a/packages/belos/src/BelosRCGSolMgr.hpp b/packages/belos/src/BelosRCGSolMgr.hpp index b813da2f7407..605139509ad1 100644 --- a/packages/belos/src/BelosRCGSolMgr.hpp +++ b/packages/belos/src/BelosRCGSolMgr.hpp @@ -372,7 +372,13 @@ namespace Belos { static constexpr int outputStyle_default_ = Belos::General; static constexpr int outputFreq_default_ = -1; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // // Current solver values. diff --git a/packages/belos/src/BelosTFQMRSolMgr.hpp b/packages/belos/src/BelosTFQMRSolMgr.hpp index ec69b4a3da80..91e3d5ac485e 100644 --- a/packages/belos/src/BelosTFQMRSolMgr.hpp +++ b/packages/belos/src/BelosTFQMRSolMgr.hpp @@ -269,7 +269,13 @@ namespace Belos { static constexpr const char * impResScale_default_ = "Norm of Preconditioned Initial Residual"; static constexpr const char * expResScale_default_ = "Norm of Initial Residual"; static constexpr const char * label_default_ = "Belos"; +// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas +#if defined(_WIN32) && defined(__clang__) + static constexpr std::ostream * outputStream_default_ = + __builtin_constant_p(reinterpret_cast(&std::cout)); +#else static constexpr std::ostream * outputStream_default_ = &std::cout; +#endif // Current solver values. MagnitudeType convtol_, impTolScale_, achievedTol_; diff --git a/packages/muelu/src/Utils/MueLu_Utilities.cpp b/packages/muelu/src/Utils/MueLu_Utilities.cpp index 00cbddb9ed91..8ccc4948fc57 100644 --- a/packages/muelu/src/Utils/MueLu_Utilities.cpp +++ b/packages/muelu/src/Utils/MueLu_Utilities.cpp @@ -54,9 +54,13 @@ #ifdef HAVE_MPI #include +#ifdef _WIN32 +#include +#else #include #include #endif +#endif @@ -265,7 +269,7 @@ bool IsParamValidVariable(const std::string& name) int len; MPI_Get_processor_name(hostname,&len); struct hostent * host = gethostbyname(hostname); - int myaddr = (int) htonl(inet_network(inet_ntoa(*(struct in_addr *)host->h_addr))); + int myaddr = (int) inet_addr(inet_ntoa(*(struct in_addr *)host->h_addr)); // All-to-all exchange of address integers std::vector addressList(numRanks); diff --git a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybrid2GL.hpp b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybrid2GL.hpp index 580219b6d3b9..6cf2b055ad83 100644 --- a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybrid2GL.hpp +++ b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybrid2GL.hpp @@ -5,7 +5,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "Zoltan2_Algorithm.hpp" #include "Zoltan2_GraphModel.hpp" diff --git a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1-2GL.hpp b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1-2GL.hpp index 1885f42714ee..1376b7c61592 100644 --- a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1-2GL.hpp +++ b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1-2GL.hpp @@ -5,7 +5,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "Zoltan2_Algorithm.hpp" #include "Zoltan2_GraphModel.hpp" diff --git a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1.hpp b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1.hpp index 36f1d46f8054..627a80d68727 100644 --- a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1.hpp +++ b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD1.hpp @@ -6,7 +6,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include #include "Zoltan2_Algorithm.hpp" diff --git a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD2.hpp b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD2.hpp index 953a66d809b2..1fd457e8dd02 100644 --- a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD2.hpp +++ b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridD2.hpp @@ -5,7 +5,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "Zoltan2_Algorithm.hpp" #include "Zoltan2_GraphModel.hpp" diff --git a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridPD2.hpp b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridPD2.hpp index 75f1707e265e..b1773a4b80f1 100644 --- a/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridPD2.hpp +++ b/packages/zoltan2/core/src/algorithms/color/Zoltan2_AlgHybridPD2.hpp @@ -5,7 +5,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "Zoltan2_Algorithm.hpp" #include "Zoltan2_GraphModel.hpp" diff --git a/packages/zoltan2/core/src/input/Zoltan2_InputTraits.hpp b/packages/zoltan2/core/src/input/Zoltan2_InputTraits.hpp index 595c41a03809..ff482f7d7fd9 100644 --- a/packages/zoltan2/core/src/input/Zoltan2_InputTraits.hpp +++ b/packages/zoltan2/core/src/input/Zoltan2_InputTraits.hpp @@ -211,6 +211,10 @@ struct InputTraits { #ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifdef _MSC_VER + typedef SSIZE_T ssize_t; +#endif + // This combination of macros is used to define a single line // Z2_STATIC_ASSERT_TYPES for each InputTraits with custom template types #define Z2_ISSAME(s,type) (std::is_same< s, type >::value)