Skip to content

Update bin2h.cmake to avoid -Werror=missing-braces #419

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zfergus
Copy link

@zfergus zfergus commented Apr 9, 2025

The header files generated by bin2h.cmake cause an error when the GCC flag -Werror=missing-braces is enabled. I fixed this by adding another set of braces around ${arrayValues} on Line 98.

Edit: I pushed some more changes to my fork which automatically got included in this PR. My new changes make use of FMT in SPDLOG instead of the system-installed version.

else()
target_link_libraries(kompute PUBLIC Vulkan::Vulkan
kp_logger
kp_shader
fmt::fmt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being removed?

@@ -94,7 +92,7 @@ add_subdirectory(shaders)
add_subdirectory(include)

if(KOMPUTE_OPT_INSTALL)
if (KOMPUTE_OPT_USE_BUILT_IN_FMT)
if (NOT KOMPUTE_OPT_USE_SPDLOG AND KOMPUTE_OPT_USE_BUILT_IN_FMT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the need for the extra guard check?

@@ -95,12 +95,12 @@ function(BIN2H)
set(namespaceStart "namespace ${HEADER_NAMESPACE} {")
set(namespaceEnd "} // namespace ${HEADER_NAMESPACE}")
set(arrayIncludes "#pragma once\n#include <array>\n#include <cstdint>")
set(arrayDefinition "const std::array<uint32_t, ${arraySize}> ${BIN2H_VARIABLE_NAME} = { ${arrayValues} };")
set(arrayDefinition "const std::array<uint32_t, ${arraySize}> ${BIN2H_VARIABLE_NAME} = { { ${arrayValues} } };")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work for both spdlog and fmt?

Copy link
Member

@axsaucedo axsaucedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, just getting around - would you be able to provide more context on the comments? + also re-commit with the DCO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants