On 2020-05-08 14:25, Arnd Bergmann wrote: > On Fri, May 8, 2020 at 1:16 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: >> >> On 2020-05-07 15:00, Nick Desaulniers wrote: >>> On Thu, May 7, 2020 at 12:18 PM kbuild test robot <lkp@xxxxxxxxx> wrote: >>>> All errors (new ones prefixed by >>): >>>> >>>> In file included from drivers/scsi/qla2xxx/qla_dbg.c:77: >>>>>> include/trace/events/qla.h:13:32: error: unknown warning group '-Wsuggest-attribute=format', ignored [-Werror,-Wunknown-warning-option] >>>> #pragma GCC diagnostic ignored "-Wsuggest-attribute=format" >>>> ^ >>> >>> Hi Bart, >>> These compiler specific pragma's are not toolchain portable. You'll >>> need to wrap them in: >>> #ifndef __clang__ >>> preprocessor macros, or I think we have a pragma helper in tree that >>> helps with compiler specific pragmas. IIRC it uses _Pragma to define >>> pragmas in macros. >> Hi Nick, >> >> Thanks for the feedback. I will have a look at _Pragma() and see what >> the best way is to suppress this warning. > > The __diag_ignore() macro in linux/compiler.h should work for this. Thanks Arnd, that's good to know. Is using __diag_ignore() mandatory in this case? The following construct seems to work fine with both gcc and clang: #define QLA_MSG_MAX 256 +#pragma GCC diagnostic push +#ifndef __clang__ +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + DECLARE_EVENT_CLASS(qla_log_event, TP_PROTO(const char *buf, struct va_format *vaf), @@ -27,6 +32,8 @@ DECLARE_EVENT_CLASS(qla_log_event, TP_printk("%s %s", __get_str(buf), __get_str(msg)) ); +#pragma GCC diagnostic pop + DEFINE_EVENT(qla_log_event, ql_dbg_log, TP_PROTO(const char *buf, struct va_format *vaf), TP_ARGS(buf, vaf) Bart.