mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
clang/gcc: enable a bunch more warnings (#91)
* clang/gcc: enable -pedantic warnings * suppress a GCC-specific warning in stb_image * And some clang-specific warnings * -Wconversion (clang) -Wold-style-cast (clang+gcc) and fix a few warnings that show up with these (and a few more with -Wconversion on gcc, even though that's not enabled by default) * bunch more warnings * fixes * remove merge error
This commit is contained in:
@@ -51,3 +51,7 @@ add_library(utils STATIC ${UTILS_SOURCES})
|
||||
target_link_libraries(utils nxt_backend shaderc nxtcpp nxt)
|
||||
target_include_directories(utils PUBLIC ${SRC_DIR})
|
||||
NXTInternalTarget("" utils)
|
||||
if(NOT MSVC)
|
||||
# allow C-style casts -- for shaderc
|
||||
set_property(TARGET utils APPEND PROPERTY COMPILE_OPTIONS "-Wno-old-style-cast")
|
||||
endif()
|
||||
|
||||
@@ -50,8 +50,13 @@ namespace utils {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = (result.cend() - result.cbegin());
|
||||
builder.SetSource(static_cast<uint32_t>(size), result.cbegin());
|
||||
// result.cend and result.cbegin return pointers to uint32_t.
|
||||
const uint32_t* resultBegin = result.cbegin();
|
||||
const uint32_t* resultEnd = result.cend();
|
||||
// So this size is in units of sizeof(uint32_t).
|
||||
ptrdiff_t resultSize = resultEnd - resultBegin;
|
||||
// SetSource takes data as uint32_t*.
|
||||
builder.SetSource(static_cast<uint32_t>(resultSize), result.cbegin());
|
||||
|
||||
#ifdef DUMP_SPIRV_ASSEMBLY
|
||||
{
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
namespace utils {
|
||||
|
||||
#if defined(NXT_PLATFORM_WINDOWS)
|
||||
void USleep(int usecs) {
|
||||
void USleep(unsigned int usecs) {
|
||||
Sleep(static_cast<DWORD>(usecs / 1000));
|
||||
}
|
||||
#elif defined(NXT_PLATFORM_POSIX)
|
||||
void USleep(int usecs) {
|
||||
void USleep(unsigned int usecs) {
|
||||
usleep(usecs);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
void USleep(int usecs);
|
||||
void USleep(unsigned int usecs);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user