From 29a49f5d150911428a35943be8d9fc226865eb1b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 2 Jan 2019 17:00:40 -0500 Subject: color: Check format strings + args for cfprintf() %{cc} is now ${cc} to avoid warnings about an unrecognized format specifier, and %P and %L are now %pP and %pL to make them look more like standard format strings. --- util.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 836db37..4a9947c 100644 --- a/util.h +++ b/util.h @@ -67,6 +67,15 @@ # define O_DIRECTORY 0 #endif +/** + * Adds compiler warnings for bad printf()-style function calls, if supported. + */ +#if __GNUC__ +# define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args))) +#else +# define BFS_FORMATTER(fmt, args) +#endif + /** * readdir() wrapper that makes error handling cleaner. */ -- cgit v1.2.3