namespace {
void Panic() { while (1); }
} // namespace
extern "C" void kernel() { Panic(); }
The clang++ really does optimize this away:
https://godbolt.org/z/1Wf135918
The same thing happens when I let clang++ compile a C version as C++:
https://godbolt.org/z/MxcGfWhej
However, if I compile it as C with clang, I get an infinite loop:
https://godbolt.org/z/x63fo33Wa
namespace {
void Panic() { while (1); }
} // namespace
extern "C" void kernel() { Panic(); }
The clang++ really does optimize this away:
https://godbolt.org/z/1Wf135918
The same thing happens when I let clang++ compile a C version as C++:
https://godbolt.org/z/MxcGfWhej
However, if I compile it as C with clang, I get an infinite loop:
https://godbolt.org/z/x63fo33Wa