Re: [PATCH v2] drm/amd/display: Avoid disabling GCC specific flag with clang for snprintf_count()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@xxxxxxx>
Cc: Harry Wentland <harry.wentland@xxxxxxx>
Cc: Aurabindo Pillai <aurabindo.pillai@xxxxxxx>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
---

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;




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux