On Tue, 26 Aug 2025 at 12:42, Daniel P. Berrangé <berra...@redhat.com> wrote: > > On Fri, Aug 22, 2025 at 02:26:44PM +0200, Paolo Bonzini wrote: > > This simplifies the Python code and reduces the size of the tracepoints.
> > +void ftrace_write(const char *fmt, ...) > > +{ > > + char ftrace_buf[MAX_TRACE_STRLEN]; > > + int unused __attribute__ ((unused)); > > + int trlen; > > + va_list ap; > > + > > + va_start(ap, fmt); > > + trlen = vsnprintf(ftrace_buf, MAX_TRACE_STRLEN, fmt, ap); > > + va_end(ap); > > + > > + trlen = MIN(trlen, MAX_TRACE_STRLEN - 1); > > + unused = write(trace_marker_fd, ftrace_buf, trlen); > > You're just copying the existing code pattern which is fine for now so > > Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> > > > More generally though, IMHO, QEMU would be better off bringing in > gnulib's 'ignore_value' macro, but simplified since we don't care > about ancient GCC > > #define ignore_value(x) \ > (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) > > so that we don't need to play games with extra variables. eg > > ignore_value(write(trace_marker_fd, ftrace_buf, trlen)); Isn't there a way to write that that explicitly tells the compiler "this is unused" (i.e. with the 'unused' attribute) rather than relying on a particular construct to not trigger a warning? -- PMM