diff options
| author | jvoisin | 2023-08-20 21:45:55 +0200 |
|---|---|---|
| committer | jvoisin | 2023-08-20 21:45:55 +0200 |
| commit | 8802b2375ff7f9bf45fb316228e0349dc8d93d2d (patch) | |
| tree | c791ea71e93e97479addfa43fe06d80ddab4156d /include | |
| parent | 737b5207e12bb12a270fa1a385048fcf55617e43 (diff) | |
Add two __format annotations
Diffstat (limited to 'include')
| -rw-r--r-- | include/stdio.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/stdio.h b/include/stdio.h index 1d06dae..4f304a5 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
| @@ -36,8 +36,6 @@ extern "C" { | |||
| 36 | #undef fread | 36 | #undef fread |
| 37 | #undef fwrite | 37 | #undef fwrite |
| 38 | #undef popen | 38 | #undef popen |
| 39 | #undef snprintf | ||
| 40 | #undef sprintf | ||
| 41 | #undef vsnprintf | 39 | #undef vsnprintf |
| 42 | #undef vsprintf | 40 | #undef vsprintf |
| 43 | 41 | ||
| @@ -120,6 +118,7 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) | |||
| 120 | #endif | 118 | #endif |
| 121 | 119 | ||
| 122 | __access(read_write, 1, 2) | 120 | __access(read_write, 1, 2) |
| 121 | __format(printf, 3, 0) | ||
| 123 | __diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4) | 122 | __diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4) |
| 124 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, | 123 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, |
| 125 | const char *__f, __builtin_va_list __v) | 124 | const char *__f, __builtin_va_list __v) |
| @@ -131,6 +130,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, | |||
| 131 | return __orig_vsnprintf(__s, __n, __f, __v); | 130 | return __orig_vsnprintf(__s, __n, __f, __v); |
| 132 | } | 131 | } |
| 133 | 132 | ||
| 133 | __format(printf, 2, 0) | ||
| 134 | __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) | 134 | __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) |
| 135 | _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, | 135 | _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, |
| 136 | __builtin_va_list __v) | 136 | __builtin_va_list __v) |
| @@ -163,6 +163,9 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, | |||
| 163 | * 3) not implementing these under clang, which is what we do for now | 163 | * 3) not implementing these under clang, which is what we do for now |
| 164 | */ | 164 | */ |
| 165 | 165 | ||
| 166 | #undef snprintf | ||
| 167 | #undef sprintf | ||
| 168 | |||
| 166 | __access(read_write, 1, 2) | 169 | __access(read_write, 1, 2) |
| 167 | __format(printf, 3, 4) | 170 | __format(printf, 3, 4) |
| 168 | _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, | 171 | _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, |
