[cfe-dev] [RFC] new format string attributes

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 25 08:34:28 PDT 2020


On Wed, Mar 25, 2020 at 10:32 AM Marcus Johnson
<bumblebritches57 at gmail.com> wrote:
>>
>> Hey Aaron,
> I'm only planning on adding support to Clang for static analysis, FixIts, etc.

This has me a bit confused then. If the libc implementation doesn't
know about the new length modifiers, why do you want to add them to
the format string checker? We don't want to suggest users use length
modifiers that are UB at runtime because the C library doesn't support
them.

> I am planning on introducing a proposal to the C and C++ committees to add these length modifiers for c and s type specifiers.
>
> As for UTF-8 I was planning on just using the no-length-modifier c or s type specifier.

Okay, so you hope that eventually the standards committees will adopt
this, and then drive the libc implementations to support it?

> > Why do you need a new format archtype?
>
> Once again, I'm just trying to add support for static analysis, checking, etc.

That doesn't answer why we need a new format archtype. The archtypes
are used because we want the check to model behavior specific to some
API. If I understand your proposal properly, you're not proposing to
add anything like uprintf() to a C library (and such an API doesn't
already exist), so adding a new archtype surprises me. I would have
thought the existing archtypes would suffice, but maybe I'm still
misunderstanding a part of your proposal.

~Aaron


More information about the cfe-dev mailing list