projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9e6472
)
tools/nolibc: annotate va_list printf formats
author
Thomas Weißschuh
<linux@weissschuh.net>
Thu, 23 Nov 2023 21:53:13 +0000
(22:53 +0100)
committer
Thomas Weißschuh
<linux@weissschuh.net>
Mon, 11 Dec 2023 21:38:32 +0000
(22:38 +0100)
__attribute__(format(printf)) can also be used for functions that take a
va_list argument.
As per the GCC docs:
For functions where the arguments are not available to be checked
(such as vprintf), specify the third parameter as zero.
Link:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/stdio.h
patch
|
blob
|
history
diff --git
a/tools/include/nolibc/stdio.h
b/tools/include/nolibc/stdio.h
index d7ef43973916c77853d9ae4f8ce75c9b3938ca58..16cd4d8072518b889ab97e7851a97dda740c7089 100644
(file)
--- a/
tools/include/nolibc/stdio.h
+++ b/
tools/include/nolibc/stdio.h
@@
-212,7
+212,7
@@
char *fgets(char *s, int size, FILE *stream)
* - %s
* - unknown modifiers are ignored.
*/
-static __attribute__((unused))
+static __attribute__((unused
, format(printf, 2, 0)
))
int vfprintf(FILE *stream, const char *fmt, va_list args)
{
char escape, lpref, c;
@@
-318,7
+318,7
@@
int vfprintf(FILE *stream, const char *fmt, va_list args)
return written;
}
-static __attribute__((unused))
+static __attribute__((unused
, format(printf, 1, 0)
))
int vprintf(const char *fmt, va_list args)
{
return vfprintf(stdout, fmt, args);