From d6593e4138b62313185b2e1cff88cb73e4f011f8 Mon Sep 17 00:00:00 2001 From: emankov Date: Sat, 29 Dec 2018 15:51:06 +0300 Subject: [PATCH] [HIPIFY][win] Set -std=c++14 if MSVC + Due to latest Windows SDK implementation based on c++14 features, '-std+c++14' is a must; + Doesn't affect older versions of MSVC 2017, 2015 (the latest supported is MSVC 2015); + On linux still '-std=c++11' is a must; + Exclude '-std=' from lit config. [ROCm/hip commit: 2d3f62c3e11668030a026f243982f3728c6c7b40] --- projects/hip/hipify-clang/src/main.cpp | 6 +++++- projects/hip/tests/hipify-clang/lit.cfg | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/hip/hipify-clang/src/main.cpp b/projects/hip/hipify-clang/src/main.cpp index 7dc42f8882..8549e80d18 100644 --- a/projects/hip/hipify-clang/src/main.cpp +++ b/projects/hip/hipify-clang/src/main.cpp @@ -173,7 +173,11 @@ int main(int argc, const char **argv) { Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(sInclude.c_str(), ct::ArgumentInsertPosition::BEGIN)); Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("--cuda-host-only", ct::ArgumentInsertPosition::BEGIN)); // Ensure at least c++11 is used. - Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-std=c++11", ct::ArgumentInsertPosition::BEGIN)); + std::string stdCpp = "-std=c++11"; +#if defined(_MSC_VER) + stdCpp = "-std=c++14"; +#endif + Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(stdCpp.c_str(), ct::ArgumentInsertPosition::BEGIN)); #if defined(HIPIFY_CLANG_RES) Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES)); #endif diff --git a/projects/hip/tests/hipify-clang/lit.cfg b/projects/hip/tests/hipify-clang/lit.cfg index d0328c06c2..e5805a5663 100644 --- a/projects/hip/tests/hipify-clang/lit.cfg +++ b/projects/hip/tests/hipify-clang/lit.cfg @@ -65,7 +65,7 @@ clang_args = "-x cuda -v --cuda-gpu-arch=sm_30 --cuda-path='%s'" if sys.platform in ['win32']: run_test_ext = ".bat" hipify_path += "/" + config.build_type - clang_args += " -isystem'%s'/common/inc -std=c++14" + clang_args += " -isystem'%s'/common/inc" else: run_test_ext = ".sh" clang_args += " -isystem'%s'/samples/common/inc"