kern: fix building without debugging turned on

This commit is contained in:
Michael Scire 2020-02-20 10:14:27 -08:00
parent efae01c165
commit bb3f7c8ab9
3 changed files with 15 additions and 8 deletions

View file

@ -49,6 +49,6 @@ namespace ams::kern {
#define MESOSPHERE_LOG(fmt, ...) MESOSPHERE_RELEASE_LOG((fmt), ## __VA_ARGS__) #define MESOSPHERE_LOG(fmt, ...) MESOSPHERE_RELEASE_LOG((fmt), ## __VA_ARGS__)
#define MESOSPHERE_VLOG(fmt, vl) MESOSPHERE_RELEASE_VLOG((fmt), (vl)) #define MESOSPHERE_VLOG(fmt, vl) MESOSPHERE_RELEASE_VLOG((fmt), (vl))
#else #else
#define MESOSPHERE_LOG(fmt, ...) #define MESOSPHERE_LOG(fmt, ...) do { MESOSPHERE_UNUSED(fmt); MESOSPHERE_UNUSED(__VA_ARGS__); } while (0)
#define MESOSPHERE_VLOG(fmt, vl) #define MESOSPHERE_VLOG(fmt, vl) do { MESOSPHERE_UNUSED(fmt); MESOSPHERE_UNUSED(vl); } while (0)
#endif #endif

View file

@ -19,15 +19,22 @@
namespace ams::kern { namespace ams::kern {
NORETURN void Panic(const char *file, int line, const char *format, ...) __attribute__((format(printf, 3, 4))); template<typename... ArgTypes>
NORETURN void Panic(); ALWAYS_INLINE void UnusedImpl(ArgTypes... args) {
(static_cast<void>(args), ...);
}
NORETURN NOINLINE void Panic(const char *file, int line, const char *format, ...) __attribute__((format(printf, 3, 4)));
NORETURN NOINLINE void Panic();
} }
#define MESOSPHERE_UNUSED(...) ::ams::kern::UnusedImpl(__VA_ARGS__)
#ifdef MESOSPHERE_ENABLE_DEBUG_PRINT #ifdef MESOSPHERE_ENABLE_DEBUG_PRINT
#define MESOSPHERE_PANIC(...) ::ams::kern::Panic(__FILE__, __LINE__, __VA_ARGS__) #define MESOSPHERE_PANIC(...) do { ::ams::kern::Panic(__FILE__, __LINE__, __VA_ARGS__); } while(0)
#else #else
#define MESOSPHERE_PANIC(...) ::ams::kern::Panic() #define MESOSPHERE_PANIC(...) do { MESOSPHERE_UNUSED(__VA_ARGS__); ::ams::kern::Panic(); } while(0)
#endif #endif
#ifdef MESOSPHERE_ENABLE_ASSERTIONS #ifdef MESOSPHERE_ENABLE_ASSERTIONS
@ -58,7 +65,7 @@ namespace ams::kern {
#define MESOSPHERE_AUDIT(expr) do { static_cast<void>(expr); } while (0) #define MESOSPHERE_AUDIT(expr) do { static_cast<void>(expr); } while (0)
#endif #endif
#define MESOSPHERE_TODO(arg) ({ constexpr const char *__mesosphere_todo = arg; MESOSPHERE_PANIC("TODO (%s): %s\n", __PRETTY_FUNCTION__, __mesosphere_todo); }) #define MESOSPHERE_TODO(arg) ({ constexpr const char *__mesosphere_todo = arg; static_cast<void>(__mesosphere_todo); MESOSPHERE_PANIC("TODO (%s): %s\n", __PRETTY_FUNCTION__, __mesosphere_todo); })
#define MESOSPHERE_TODO_IMPLEMENT() MESOSPHERE_TODO("Implement") #define MESOSPHERE_TODO_IMPLEMENT() MESOSPHERE_TODO("Implement")
#define MESOSPHERE_ABORT() MESOSPHERE_PANIC("Abort()\n"); #define MESOSPHERE_ABORT() MESOSPHERE_PANIC("Abort()\n");

View file

@ -322,7 +322,7 @@ namespace ams::kern::board::nintendo::nx {
void KSystemControl::StopSystem() { void KSystemControl::StopSystem() {
if (g_call_smc_on_panic) { if (g_call_smc_on_panic) {
/* Display a panic screen via secure monitor. */ /* Display a panic screen via secure monitor. */
/* TODO: Enable in release: smc::Panic(0xF00); */ smc::Panic(0xF00);
} }
while (true) { /* ... */ } while (true) { /* ... */ }
} }