From 33f9170dae59116f74a8189f2516cc12c8f90c15 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Thu, 11 May 2023 13:20:11 -0700 Subject: commonlib: compiler.h: Add __printf macro This patch adds the `__printf' macro to comply with checkpatch following warning: Prefer __printf(1, 2) over __attribute__((format(printf, 1, 2))) BRANCH=firmware-brya-14505.B TEST=Successful compilation with `__printf(1, 2)' instead of `__attribute__((format(printf, 1, 2)))' Change-Id: Ic2d90478ab0955c2ad0955e8cff5be76bfb2e741 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/75159 Reviewed-by: Cliff Huang Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Angel Pons Reviewed-by: Felix Singer --- src/commonlib/bsd/include/commonlib/bsd/compiler.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commonlib/bsd/include/commonlib/bsd/compiler.h b/src/commonlib/bsd/include/commonlib/bsd/compiler.h index 87ac0c4aed..6bde28db0e 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/compiler.h +++ b/src/commonlib/bsd/include/commonlib/bsd/compiler.h @@ -58,6 +58,10 @@ #define __fallthrough __attribute__((__fallthrough__)) #endif +#ifndef __printf +#define __printf(a, b) __attribute__((format(printf, a, b))) +#endif + /* * This evaluates to the type of the first expression, unless that is constant * in which case it evaluates to the type of the second. This is useful when -- cgit v1.2.1