Skip to content
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

Fix compiler warnings in Elf.cpp #6992

Merged
merged 2 commits into from
Sep 6, 2022
Merged

Fix compiler warnings in Elf.cpp #6992

merged 2 commits into from
Sep 6, 2022

Conversation

steven-johnson
Copy link
Contributor

@steven-johnson steven-johnson commented Sep 1, 2022

Some versions of GCC will complain that there is a possible use of uninitialized field Sym<>::st_info here; that's technically true, in that it is a bitfield that we previously set via two calls, so it temporarily could use uninitialized bits, but those would immediately be overwritten by well-defined bits. That said, the API could have been misused, so I collapsed Sym::set_type and Sym::set_bindings into a single call to avoid this warning.

While I was there, I did a little hygiene on Rel<> and Rela<> as well, as there was an unused-but-similarly-dubious API there. Also added some C++17 if constexpr love.

Some versions of GCC will complain that there is a possible use of uninitialized field `Sym<>::st_info` here; that's technically true, in that it is a bitfield that we previously set via two calls, so it temporarily could use uninitialized bits, but those would immediately be overwritten by well-defined bits. That said, the API could have been misused, so I collapsed Sym::set_type and Sym::set_bindings into a single call to avoid this warning.

While I was there, I did a little hygiene on Rel<> and Rela<> as well, as there was an unused-but-similarly-dubious API there. Also added some C++17 `if constexpr` love.
src/Elf.cpp Outdated Show resolved Hide resolved
@steven-johnson steven-johnson merged commit cbe2e63 into main Sep 6, 2022
@steven-johnson steven-johnson deleted the srj/elf-fix branch September 6, 2022 17:18
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
* Fix compiler warnings in Elf.cpp

Some versions of GCC will complain that there is a possible use of uninitialized field `Sym<>::st_info` here; that's technically true, in that it is a bitfield that we previously set via two calls, so it temporarily could use uninitialized bits, but those would immediately be overwritten by well-defined bits. That said, the API could have been misused, so I collapsed Sym::set_type and Sym::set_bindings into a single call to avoid this warning.

While I was there, I did a little hygiene on Rel<> and Rela<> as well, as there was an unused-but-similarly-dubious API there. Also added some C++17 `if constexpr` love.

* Removed constexpr
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