-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build ICD Loader using Clang on Windows #177
base: main
Are you sure you want to change the base?
Conversation
@@ -270,7 +270,7 @@ void *khrIcdOsLibraryLoad(const char *libraryName) | |||
} | |||
if (!hTemp) | |||
{ | |||
KHR_ICD_TRACE("Failed to load driver. Windows error code is %d.\n", GetLastError()); | |||
KHR_ICD_TRACE("Failed to load driver. Windows error code is %lu.\n", GetLastError()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use %"PRIuDW"
here instead of %lu
.
KHR_ICD_TRACE("Failed to load driver. Windows error code is %lu.\n", GetLastError()); | |
KHR_ICD_TRACE("Failed to load driver. Windows error code is %"PRIuDW".\n", GetLastError()); |
cmake-latest: | ||
runs-on: ${{ matrix.OS }} | ||
strategy: | ||
matrix: | ||
OS : [ubuntu-20.04] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu 20.04 is not tested anymore after those changes. Is this intended?
#if defined(_MSC_VER) && !defined(__clang__) | ||
#pragma warning( push ) | ||
#pragma warning( disable : 4152 ) | ||
#elif defined(__clang__) | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wpedantic" | ||
#endif | ||
return GetProcAddress( (HMODULE)library, functionName); | ||
#if defined(_MSC_VER) && !defined(__clang__) | ||
#pragma warning( pop ) | ||
#elif defined(__clang__) | ||
#pragma clang diagnostic pop | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try using:
#if defined(_MSC_VER) && !defined(__clang__) | |
#pragma warning( push ) | |
#pragma warning( disable : 4152 ) | |
#elif defined(__clang__) | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wpedantic" | |
#endif | |
return GetProcAddress( (HMODULE)library, functionName); | |
#if defined(_MSC_VER) && !defined(__clang__) | |
#pragma warning( pop ) | |
#elif defined(__clang__) | |
#pragma clang diagnostic pop | |
#endif | |
return (void *)(intptr_t)GetProcAddress( (HMODULE)library, functionName); |
here. It would be consistent with what we do at other place in the code. You may require an additional include.
This work was born out of grievance of reproducing non-MSVC specific warnings, errors and linker failures on the OpenCL-Layers project on Windows without having to fire up containers or building-installing under WSL. (At a larger scale, using Clang-derivates on Windows such as ComputeCpp often blow up the console with warnings if the device compiler sees the OpenCL headers.)
Beside touching up the source code to fix warnings, two major things were implemented in CI:
clang-cl.exe
, the MSVC-like CLI of Clang.Note: Overall I'm fairly unsatisfied how much code getting this range of CI coverage takes. (Linux/Mac/Win, GCC/Clang/MSVC, C99/11/17, with/without lang exts, Debug/Release) CI is doing the very same thing, but with 2-3 lines of difference for every test matrix elem. I'll be thinking about how to achieve the same coverage with a unified script and much less duplication of code. I would like the scripts to be much simpler.