Make log __attribute__(format), so the compiler can warn us of bad format strings

This commit is contained in:
apio 2022-11-30 17:28:46 +01:00
parent 3f40ccd703
commit 2bc99f2e6e
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#pragma once
#include <Attributes.h>
#include <Result.h>
#include <stdarg.h>
@ -11,7 +12,7 @@ enum class LogLevel
};
Result<void> vlog(LogLevel level, const char* format, va_list ap);
Result<void> log(LogLevel level, const char* format, ...);
Result<void> log(LogLevel level, const char* format, ...) _format(2, 3);
void setup_log(bool enable_debug, bool enable_serial, bool enable_text_console);
bool log_debug_enabled();

View File

@ -33,6 +33,10 @@ Result<void> init()
to_dynamic_unit(MemoryManager::reserved(), buffer, sizeof(buffer));
kinfoln("Reserved memory: %s", buffer);
volatile char* p = (volatile char*)0xefe0f3445692d;
*p = 7;
return {};
}