Date: Fri, 23 Feb 2024 13:30:47 -0800
(https://isocpp.org/std/submit-issue led me to believe there isn't a
public bug database, and i should send a mail here.)
clang recently started warning about using scoped enums as arguments
to varargs functions without a cast. this caused a lot of warning spam
in Android, and a lot of confusion as to why there's even a warning
here.
apparently the background is
https://github.com/llvm/llvm-project/issues/38717#issuecomment-981004156
--- apparently the standard only mentions promotions in this context
for regular enums, not scoped enums.
it seems like there were two possibilities here:
1. scoped enums were intentionally excluded. (but this was not
explicitly stated, nor was there any rationale given, so this seems
unlikely?)
2. scoped enums were accidentally excluded, because the relevant
section(s) were missed when updating the specification to include
scoped enums. (this seems more likely?)
hopefully we can get clang to at least be quiet about the cases that
don't need promotion, but i'd very much prefer to avoid a lot of
unnecessary code churn -- that makes the code less readable for no
obvious benefit -- is this was indeed an oversight in the spec that we
can get fixed there to remove the threat of UB.
it's not the standard's fault, but it's particularly unfortunate that
this warning is part of -Wformat, which means our current options are
"disable -Wformat -- including all the definitely-a-bug-right-now
cases" or "static_cast<int>() in all your debug printf()s" :-(
public bug database, and i should send a mail here.)
clang recently started warning about using scoped enums as arguments
to varargs functions without a cast. this caused a lot of warning spam
in Android, and a lot of confusion as to why there's even a warning
here.
apparently the background is
https://github.com/llvm/llvm-project/issues/38717#issuecomment-981004156
--- apparently the standard only mentions promotions in this context
for regular enums, not scoped enums.
it seems like there were two possibilities here:
1. scoped enums were intentionally excluded. (but this was not
explicitly stated, nor was there any rationale given, so this seems
unlikely?)
2. scoped enums were accidentally excluded, because the relevant
section(s) were missed when updating the specification to include
scoped enums. (this seems more likely?)
hopefully we can get clang to at least be quiet about the cases that
don't need promotion, but i'd very much prefer to avoid a lot of
unnecessary code churn -- that makes the code less readable for no
obvious benefit -- is this was indeed an oversight in the spec that we
can get fixed there to remove the threat of UB.
it's not the standard's fault, but it's particularly unfortunate that
this warning is part of -Wformat, which means our current options are
"disable -Wformat -- including all the definitely-a-bug-right-now
cases" or "static_cast<int>() in all your debug printf()s" :-(
Received on 2024-02-23 21:30:59