[PATCH v2] drm/amd/display: Avoid disabling GCC specific flag with clang for snprintf_count()
Rodrigo Siqueira Jordao
Rodrigo.Siqueira at amd.com
Fri Jun 2 15:14:43 UTC 2023
Hi,
Imho, it makes more sense to use:
https://patchwork.freedesktop.org/patch/540285
Thanks
Siqueira
On 6/1/23 22:14, Srinivasan Shanmugam wrote:
> 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;
More information about the amd-gfx
mailing list