Re: [PATCH 1/2] tracing: work around -Wmissing-format-attribute warning
"Arnd Bergmann" <[email protected]> Wed, 03 Jun 2026 15:10:08 +0200
| Newsgroups | dev.linux.lists.brcm80211,dev.linux.lists.llvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rdma,org.kernel.vger.linux-trace-kernel,org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 3, 2026, at 14:49, Rasmus Villemoes wrote: > On Wed, Jun 03 2026, "Arnd Bergmann" <[email protected]> wrote: >> On Wed, Jun 3, 2026, at 09:15, Rasmus Villemoes wrote: > I don't remember what minimum gcc we currently require, but gcc 9 > introduced another attribute that is apperently meant for cases like > this: 'copy'. The minimum version is gcc-8. > This seems to build: >... > +int __vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args) > + __alias(vsnprintf) __attribute__((__copy__(vsnprintf))); > + > > That at least should handle any future "gcc knows this-or-that about the > vsnprintf function". But I don't know if clang supports that copy > mechanism or if the minimum supported gcc is too old. clang-22 and gcc-8 don't like the attribute, but also don't complain about the other mismatched attributes, so simply using the __copy() macro we already have will work on all currently supported compilers and likely all future ones as well. Arnd