Skip to content

Fix Gcc warnings#9756

Open
stsoe wants to merge 1 commit intoXilinx:masterfrom
stsoe:fix_warnings
Open

Fix Gcc warnings#9756
stsoe wants to merge 1 commit intoXilinx:masterfrom
stsoe:fix_warnings

Conversation

@stsoe
Copy link
Copy Markdown
Collaborator

@stsoe stsoe commented Apr 27, 2026

Problem solved by the commit

Avoid GCC15 warnings and adjust improper code

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

  • Known GCC 15 false positive around std::any_cast<std::vector> and vector copy/destruction at high optimization levels.
  • Don't catch by value (pyxrt)

How problem was solved, alternative solutions (if any) and why they were rejected

Adjust function in info_memory.cpp to be more pendatic in how it
checks data received from query request. Adjust the size of
ps_kernel_node to use true flexible array.

Avoid GCC15 warnings and adjust improper code

- Known GCC 15 false positive around std::any_cast<std::vector<char>>
  and vector copy/destruction at high optimization levels.
- Don't catch by value (pyxrt)

Adjust function in info_memory.cpp to be more pendatic in how it
checks data received from query request.   Adjust the size of
ps_kernel_node to use true flexible array.

Signed-off-by: Soren Soe <[email protected]>
@stsoe stsoe requested review from maxzhen and rozumx as code owners April 27, 2026 22:28
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions


for (unsigned int i = 0; i < map->pkn_count; i++)
ps_kernels.emplace_back(map->pkn_data[i]);
auto needed = sizeof(ps_kernel_node) * map->pkn_count * sizeof(ps_kernel_data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: suspicious 'sizeof' by 'sizeof' multiplication [bugprone-sizeof-expression]

    auto needed = sizeof(ps_kernel_node) * map->pkn_count * sizeof(ps_kernel_data);
                                                          ^

@@ -34,7 +24,7 @@ struct ps_kernel_data {

struct ps_kernel_node {
uint32_t pkn_count;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'uint32_t' [clang-diagnostic-error]

	uint32_t		pkn_count;
 ^

struct ps_kernel_node {
uint32_t pkn_count;
struct ps_kernel_data pkn_data[1];
struct ps_kernel_data pkn_data[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

	struct ps_kernel_data	pkn_data[];
 ^

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