From 594dcaad19dae95b8c117e020a116cf101cf2cef Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Thu, 20 Feb 2014 16:57:34 +0100 Subject: [PATCH] Add format attribute to kernel print and panic functions. --- kernel/include/sortix/kernel/log.h | 4 +++- kernel/include/sortix/kernel/panic.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/include/sortix/kernel/log.h b/kernel/include/sortix/kernel/log.h index efa0d742..986c5c03 100644 --- a/kernel/include/sortix/kernel/log.h +++ b/kernel/include/sortix/kernel/log.h @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014. This file is part of Sortix. @@ -90,6 +90,7 @@ inline size_t PrintData(const void* ptr, size_t size) return device_callback(device_pointer, (const char*) ptr, size); } +__attribute__((format(printf, 1, 2))) inline size_t PrintF(const char* format, ...) { va_list list; @@ -99,6 +100,7 @@ inline size_t PrintF(const char* format, ...) return result; } +__attribute__((format(printf, 1, 0))) inline size_t PrintFV(const char* format, va_list list) { return vprintf_callback(device_callback, device_pointer, format, list); diff --git a/kernel/include/sortix/kernel/panic.h b/kernel/include/sortix/kernel/panic.h index 79995b9c..4fd77663 100644 --- a/kernel/include/sortix/kernel/panic.h +++ b/kernel/include/sortix/kernel/panic.h @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2013. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2013, 2014. This file is part of Sortix. @@ -29,7 +29,7 @@ namespace Sortix { extern "C" __attribute__((noreturn)) void HaltKernel(); extern "C" __attribute__((noreturn)) void Panic(const char* error); -extern "C" __attribute__((noreturn)) void PanicF(const char* format, ...); +extern "C" __attribute__((noreturn, format(printf, 1, 2))) void PanicF(const char* format, ...); extern "C" void WaitForInterrupt(); } // namespace Sortix