Hi, > On 24 Aug 2022, at 11:35, Jan Beulich <jbeul...@suse.com> wrote: > > On 24.08.2022 12:22, Juergen Gross wrote: >> Hitting an ASSERT_UNREACHABLE() is always wrong, so even in production >> builds a warning seems to be appropriate when hitting one. > > I disagree, for two reasons: This violates the implication of NDEBUG > meaning ASSERT() and friends expand to no actual code. Plus if doing so > for ASSERT_UNREACHABLE(), why would we not do the same for ASSERT()? > There's a reason we have ASSERT() and friends and, independently, > WARN_ON() / BUG_ON() et al.
I agree with Jan here, this is introducing code in ASSERT which is not the intention and will end up with dead code in production mode. In NDEBUG those should appear. If something is needed or we think there could be a situation where this is reachable, then the code should be modified to use something else then ASSERT[_UNREACHABLE](). Bertrand > > Jan >