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
Work around false SLOTS defined but not used warning on GCC #10374
Conversation
|
why not just explicitly state the type and make it a |
|
I don't think there's much of a benefit of using |
|
|
|
It's definitely more idiomatic to use std::array for this sort of thing over an initializer_list. It's also shorter since with template deduction guides, you wouldn't need to state the size, you would just do: constexpr std::array SLOTS = {Slot::A, Slot::B, Slot::SP1}; |
d20f554
to
2464aa2
Compare
|
The freebsd builder doesn't like to deduce std::array, see https://dolphin.ci/#/builders/13/builds/5852 |
2464aa2
to
f2eb7d1
Compare
|
I think that's indicative more than anything that the freebsd builder needs to be updated, given that deduction guides have been supported by std lib implementations for quite a while now |
f2eb7d1
to
8090e4b
Compare
8090e4b
to
edec1d5
Compare
|
For what it's worth, I've submitted a patch to GCC to fix this issue, and the patch is expected to land in GCC 13. |
|
The patch has been merged, though it will be a while before it ends up in a release build of GCC (GCC 12 just entered the release candidate state, and this patch is for the GCC 13 branch). |
This warning was caused by #10364; see e.g. this build log. The bug in question is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80351, and it seems to be solvable by explicitly using
std::initializer_listinstead ofauto. The warning is generated only for the firstautoinitializer list, but we need to change bothSLOTSandMEMCARD_SLOTSas if onlySLOTSis changed, thenMEMCARD_SLOTSbecomes the firstautoinitializer list and generates a warning. An alternative solution is to markSLOTSas[[maybe_unused]], which does not require changingMEMCARD_SLOTS, but that seems a bit silly. (I've requested an account on the GCC bugzilla to add some additional notes there, but it hasn't been created yet.)