-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add option for stricter compiler warnings #1891
base: dev
Are you sure you want to change the base?
Add option for stricter compiler warnings #1891
Conversation
CI gfxreconstruct build queued with queue ID 311184. |
CI gfxreconstruct build # 5413 running. |
0bda28c
to
039a7dc
Compare
CI gfxreconstruct build queued with queue ID 311214. |
039a7dc
to
8bf21c2
Compare
CI gfxreconstruct build queued with queue ID 311244. |
CI gfxreconstruct build # 5416 running. |
CI gfxreconstruct build # 5416 passed. |
CI gfxreconstruct build queued with queue ID 311459. |
CI gfxreconstruct build # 5420 running. |
CI gfxreconstruct build # 5420 failed. |
CI gfxreconstruct build queued with queue ID 311489. |
CI gfxreconstruct build # 5421 running. |
reinterpret_cast<const uint8_t*>(&pointer_member) - reinterpret_cast<const uint8_t*>(&base_struct); | ||
|
||
// copy pointer-chain recursively | ||
uint32_t copy_size = vulkan_struct_deep_copy(pointer_member, count, offset_ptr(out_data, offset)); | ||
uint64_t copy_size = vulkan_struct_deep_copy(pointer_member, (uint32_t)count, offset_ptr(out_data, offset)); |
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.
do we prefer c++ style casting?
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.
we do :) I'll adjust the generator
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.
done
reinterpret_cast<const uint8_t*>(&pointer_member) - reinterpret_cast<const uint8_t*>(&base_struct); | ||
|
||
// copy pointer-chain recursively | ||
uint32_t copy_size = vulkan_struct_deep_copy(pointer_member, count, offset_ptr(out_data, offset)); | ||
uint64_t copy_size = vulkan_struct_deep_copy(pointer_member, (uint32_t)count, offset_ptr(out_data, offset)); |
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.
ditto
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.
done
const VkExtent3D scaled_extent = { static_cast<uint32_t>(std::max(extent.width * scale, 1.0f)), | ||
static_cast<uint32_t>(std::max(extent.height * scale, 1.0f)), | ||
static_cast<uint32_t>(std::max(extent.depth * scale, 1.0f)) }; | ||
const VkExtent3D scaled_extent = { static_cast<uint32_t>(std::max((float)extent.width * scale, 1.0f)), |
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.
ditto
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.
done
@@ -1877,7 +1877,7 @@ void VulkanResourcesUtil::ReadFromImageResourceLinear(VkImage ima | |||
subresource_sizes.clear(); | |||
|
|||
const double texel_size = vkuFormatTexelSizeWithAspect(format, aspect); | |||
assert(texel_size == static_cast<uint64_t>(texel_size)); | |||
assert(texel_size == static_cast<double>(static_cast<uint64_t>(texel_size))); |
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.
GFXRECON_ASSERT
and.. how about using floor(texel_size)
?
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.
damn me, I had a blackout and was searching for 'fract'
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.
changed to use std::floor
framework/util/driver_info.cpp
Outdated
version[3] = (unsigned int)((data & 0x000000000000FFFF)); | ||
uint16_t version[4] = {}; | ||
std::string str_version; | ||
version[0] = (uint16_t)((data & 0xFFFF000000000000) >> 16 * 3); |
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.
ditto
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.
and ... all done :)
CI gfxreconstruct build # 5421 failed. |
CI gfxreconstruct build queued with queue ID 311512. |
CI gfxreconstruct build # 5422 running. |
CI gfxreconstruct build # 5422 passed. |
85fe2eb
to
3729798
Compare
CI gfxreconstruct build queued with queue ID 312150. |
CI gfxreconstruct build # 5439 running. |
CMakeLists.txt
Outdated
|
||
if (USE_STRICT_COMPILER_WARNINGS) | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wconversion -Wextra -Werror -Wno-unused-parameter -Wno-unused-function -Wno-missing-field-initializers") |
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.
Is -Werror=shadow
included with these?
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.
yes, already had to fix at least one location with this appearing as error.
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.
but weird, I can not spot -Wshadow
in any of the lists for -Wall
, -Wextra
or -pedantic
- https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
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.
ok, my bad. I only saw clang-tidy warnings. will include -Wshadow
and iterate again
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.
ok, added -Wshadow
and fixed all occurances in gfxreconformat/util/graphics. thanks @panos-lunarg !
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.
Also keep in mind the parameters I used in #1890 were mostly an experiment and not to be considered the "correct" ones or the "target". They are open to discussion and we can add or remove as we see fit
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.
yes, totally agree. they are reasonably strict and a great starting point, but subject to some iteration. -Wall
and -Wextra
are already a huge leap, we even apply -pedantic
atm. depending on how much work it causes we can gradually rollback the exceptions -Wno-unused-parameter -Wno-unused-function -Wno-missing-field-initializers
CI gfxreconstruct build # 5439 failed. |
CI gfxreconstruct build queued with queue ID 312194. |
0dde75d
to
7ee61b8
Compare
CI gfxreconstruct build queued with queue ID 312200. |
CI gfxreconstruct build queued with queue ID 312202. |
77884ec
to
8b843d5
Compare
CI gfxreconstruct build queued with queue ID 312279. |
CI gfxreconstruct build # 5446 running. |
CI gfxreconstruct build # 5446 passed. |
gfxrecon_format
,gfxrecon_util
,gfxrecon_graphics
first step towards #1890