[PATCH v2] drm/amd/display: Avoid disabling GCC specific flag with clang for snprintf_count()
Srinivasan Shanmugam
srinivasan.shanmugam at amd.com
Fri Jun 2 04:14:44 UTC 2023
These warning can cause build failure:
display/dc/dcn10/dcn10_hw_sequencer_debug.c: In function ‘snprintf_count’:
display/dc/dcn10/dcn10_hw_sequencer_debug.c:56:2: warning: function ‘snprintf_count’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
The warning being disabled by this pragma is GCC specific. Guard its use
with CONFIG_CC_IS_GCC so that it is not used with clang to clear up the
error.
Cc: Hamza Mahfooz <hamza.mahfooz at amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai at amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
---
v2:
- Alternate Solution 2: for proposed
https://patchwork.freedesktop.org/patch/540285/8, suspect that
code is in DC, to see if it compiles even on windows also.
.../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c
index a0f8e31d2adc..e14b6747bbcc 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c
@@ -45,6 +45,10 @@
#include "dcn10_cm_common.h"
#include "clk_mgr.h"
+#ifdef CONFIG_CC_IS_GCC
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
+#endif
+
unsigned int snprintf_count(char *pBuf, unsigned int bufSize, char *fmt, ...)
{
int ret_vsnprintf;
--
2.25.1
More information about the amd-gfx
mailing list