2016-12-19 13:22:08

by Nicolas Iooss

[permalink] [raw]
Subject: [PATCH 1/1] x86/platform/intel/quark: add printf attribute to imr_self_test_result()

__printf attributes help detecting issues in printf format strings at
compile time.

Even though imr_selftest.c is only compiled with
CONFIG_DEBUG_IMR_SELFTEST, gcc complains about a missing format
attribute when compiling allmodconfig with -Wmissing-format-attribute.
Silent this warning by adding the attribute.

Signed-off-by: Nicolas Iooss <[email protected]>
---
arch/x86/platform/intel-quark/imr_selftest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-quark/imr_selftest.c b/arch/x86/platform/intel-quark/imr_selftest.c
index f5bad40936ac..b8f562049cad 100644
--- a/arch/x86/platform/intel-quark/imr_selftest.c
+++ b/arch/x86/platform/intel-quark/imr_selftest.c
@@ -25,7 +25,8 @@
* @fmt: format string.
* ... variadic argument list.
*/
-static void __init imr_self_test_result(int res, const char *fmt, ...)
+static __printf(2, 3)
+void __init imr_self_test_result(int res, const char *fmt, ...)
{
va_list vlist;

--
2.11.0


2016-12-20 00:16:57

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 1/1] x86/platform/intel/quark: add printf attribute to imr_self_test_result()



On 19/12/16 13:21, Nicolas Iooss wrote:
> __printf attributes help detecting issues in printf format strings at
> compile time.
>
> Even though imr_selftest.c is only compiled with
> CONFIG_DEBUG_IMR_SELFTEST, gcc complains about a missing format
> attribute when compiling allmodconfig with -Wmissing-format-attribute.
> Silent this warning by adding the attribute.
>
> Signed-off-by: Nicolas Iooss <[email protected]>
> ---
> arch/x86/platform/intel-quark/imr_selftest.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/platform/intel-quark/imr_selftest.c b/arch/x86/platform/intel-quark/imr_selftest.c
> index f5bad40936ac..b8f562049cad 100644
> --- a/arch/x86/platform/intel-quark/imr_selftest.c
> +++ b/arch/x86/platform/intel-quark/imr_selftest.c
> @@ -25,7 +25,8 @@
> * @fmt: format string.
> * ... variadic argument list.
> */
> -static void __init imr_self_test_result(int res, const char *fmt, ...)
> +static __printf(2, 3)
> +void __init imr_self_test_result(int res, const char *fmt, ...)
> {
> va_list vlist;
>
>

since I wrote this code.

Acked-by: Bryan O'Donoghue <[email protected]>

cheers

---
bod

Subject: [tip:x86/urgent] x86/platform/intel/quark: Add printf attribute to imr_self_test_result()

Commit-ID: 9120cf4fd9ae77245ce9137869bcbd16575cc633
Gitweb: http://git.kernel.org/tip/9120cf4fd9ae77245ce9137869bcbd16575cc633
Author: Nicolas Iooss <[email protected]>
AuthorDate: Mon, 19 Dec 2016 14:21:44 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 20 Dec 2016 09:37:24 +0100

x86/platform/intel/quark: Add printf attribute to imr_self_test_result()

__printf() attributes help detecting issues in printf() format strings at
compile time.

Even though imr_selftest.c is only compiled with
CONFIG_DEBUG_IMR_SELFTEST=y, GCC complains about a missing format
attribute when compiling allmodconfig with -Wmissing-format-attribute.

Silence this warning by adding the attribute.

Signed-off-by: Nicolas Iooss <[email protected]>
Acked-by: Bryan O'Donoghue <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/platform/intel-quark/imr_selftest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-quark/imr_selftest.c b/arch/x86/platform/intel-quark/imr_selftest.c
index f5bad40..b8f5620 100644
--- a/arch/x86/platform/intel-quark/imr_selftest.c
+++ b/arch/x86/platform/intel-quark/imr_selftest.c
@@ -25,7 +25,8 @@
* @fmt: format string.
* ... variadic argument list.
*/
-static void __init imr_self_test_result(int res, const char *fmt, ...)
+static __printf(2, 3)
+void __init imr_self_test_result(int res, const char *fmt, ...)
{
va_list vlist;