<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127208>127208</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[feature request] custom printf format specifiers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
olemayu
</td>
</tr>
</table>
<pre>
This would enable custom **printf** implementations to do more and also be able to rely on `-Wformat` or `-Werror=format` flag.
Here's initial suggestion:
```c
/* "int" types would implicitly also define "%lb", "%llb" and "%zb" */
#pragma clang format "%b" "int"
typedef struct string_s {
char* buf;
size_t size;
} string_t;
/* override */
#pragma clang format "%s" "string_t"
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMks-OozAMxp_GXKypQoDSHjh0tqr2AVba4ygkhmYVEjZ_ZtR5-lUCnbmuhGT8xYl_tj4Rgp4t0QDdK3TXSqR4d35whhbxSNXo1GP4ddcBP1wyCsmK0RDKFKJbEPgF-GX12sZp-0e9rIYWslFE7WzA6FA5XJwnFFahMMHhSFheiQ49mQc6i3BkL78n5xcR4cjQ-U0h752H5vp9MhkxH4BdgF1-kifgfUBtddTCYEjzTCH3heay1cCRbZ_MCb9lROBc2wicY3ys9Jwsg2upo3lskIombSkXA-_MWOKPZ1ryMtAmfJa8rOBWGjWrF_MiUBphZ9zw99q9dGfYMDOIoglD9EnGHLSd3wJC_wrsgogo78Jn-DFN0BQx6E96iyVsCvTX5824K18zu3fyXiv6T8awM349t4E-lwnsUqmhUefmLCoa6r45d82pqdvqPvSMjq2iSXW8p0b2JKhlvexPRFS38lTpgTPeMV63dcO6ujmIkVqpul7U07k_jQpaRovQ5mDM-3Jwfq50CImGmvecnSojRjKh-JVzSx9YTjNhd638kC-9jGkO0DKjQwzfz0QdTTH6RCImT-jpb6IQobs-Hb15-bmMsJLUkyYfquTNcI9xDdlaeae3Wcd7Gg_SLcBvucceXlbv_pCMwG-FLAC_7ejvA_8XAAD__4wmEBY">