summaryrefslogtreecommitdiff
path: root/include/common/debug.h
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2015-02-05 15:42:31 +0000
committerSandrine Bailleux <sandrine.bailleux@arm.com>2015-03-06 13:07:43 +0000
commitdad25049cec0e30ca9771e435064ebf853d97bba (patch)
tree9c4a067d102cb11939d662c93c521b897ba8cbf7 /include/common/debug.h
parent5930eadbe5d8d4c3f15fd910476f72cd5bf86f44 (diff)
Enable type-checking of arguments passed to printf() et al.
This patch modifies the declarations of the functions printf() et al. and adds the right GCC attribute to request the compiler to check the type of the arguments passed to these functions against the given format string. This will ensure that the compiler outputs warning messages like the following whenever it detects an inconsistency: file.c:42: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’ It also fixes the type mismatch inconsistencies that it revealed across the code base. NOTE: THIS PATCH MAY FORCE PLATFORM PORTS OR SP/SPDS THAT USE THE PRINTF FAMILY OF FUNCTIONS TO FIX ANY TYPE MISMATCH INCONSISTENCIES. Change-Id: If36bb54ec7d6dd2cb4791d89b02a24ac13fd2df6
Diffstat (limited to 'include/common/debug.h')
-rw-r--r--include/common/debug.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/common/debug.h b/include/common/debug.h
index a8dcb8da..d198c321 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -84,6 +84,6 @@
void __dead2 do_panic(void);
#define panic() do_panic()
-void tf_printf(const char *fmt, ...);
+void tf_printf(const char *fmt, ...) __printflike(1, 2);
#endif /* __DEBUG_H__ */