diff options
| author | Haelwenn (lanodan) Monnier | 2025-12-29 21:15:44 +0100 |
|---|---|---|
| committer | Julien Voisin | 2025-12-30 11:25:44 +0100 |
| commit | 4797899b24d35873211cf0cd1a2a373e2db3c528 (patch) | |
| tree | b8e1059b87e7e582674c54c66f5168d2eb54c7db /include | |
| parent | 611069d07c14bf7ace7a75fa2bc9147db8ac097d (diff) | |
Change __format into __fortify_format to fix conflict with LLVM libcxx
LLVM libcxx (20.1.8) also defines a `__format` macro in it's
C++ locale header (`/usr/include/c++/v1/locale`).
Fixes: https://github.com/jvoisin/fortify-headers/issues/76
Diffstat (limited to '')
| -rw-r--r-- | include/fortify-headers.h | 4 | ||||
| -rw-r--r-- | include/stdio.h | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/fortify-headers.h b/include/fortify-headers.h index 1581076..bdf10f6 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h | |||
| @@ -68,9 +68,9 @@ | |||
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #if __has_attribute (format) | 70 | #if __has_attribute (format) |
| 71 | #define __format(...) __attribute__ ((format (__VA_ARGS__))) | 71 | #define __fortify__format(...) __attribute__ ((format (__VA_ARGS__))) |
| 72 | #else | 72 | #else |
| 73 | #define __format(...) | 73 | #define __fortify__format(...) |
| 74 | #endif | 74 | #endif |
| 75 | 75 | ||
| 76 | #if __has_attribute (__diagnose_if) | 76 | #if __has_attribute (__diagnose_if) |
diff --git a/include/stdio.h b/include/stdio.h index aebe861..333978b 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
| @@ -76,7 +76,7 @@ _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, | |||
| 76 | return __orig_fwrite(__d, __n, __m, __f); | 76 | return __orig_fwrite(__d, __n, __m, __f); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | __format(printf, 3, 0) | 79 | __fortify__format(printf, 3, 0) |
| 80 | __access(write_only, 1, 2) | 80 | __access(write_only, 1, 2) |
| 81 | __access(read_only, 3) | 81 | __access(read_only, 3) |
| 82 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, | 82 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, |
| @@ -89,7 +89,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, | |||
| 89 | return __orig_vsnprintf(__s, __n, __f, __v); | 89 | return __orig_vsnprintf(__s, __n, __f, __v); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | __format(printf, 2, 0) | 92 | __fortify__format(printf, 2, 0) |
| 93 | __access(write_only, 1) | 93 | __access(write_only, 1) |
| 94 | __access(read_only, 2) | 94 | __access(read_only, 2) |
| 95 | _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, | 95 | _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, |
| @@ -123,7 +123,7 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, | |||
| 123 | * 3) not implementing these under clang, which is what we do for now | 123 | * 3) not implementing these under clang, which is what we do for now |
| 124 | */ | 124 | */ |
| 125 | 125 | ||
| 126 | __format(printf, 3, 4) | 126 | __fortify__format(printf, 3, 4) |
| 127 | _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, | 127 | _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, |
| 128 | const char *__f, ...) | 128 | const char *__f, ...) |
| 129 | { | 129 | { |
| @@ -134,7 +134,7 @@ _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, | |||
| 134 | return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack()); | 134 | return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack()); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | __format(printf, 2, 3) | 137 | __fortify__format(printf, 2, 3) |
| 138 | _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) | 138 | _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) |
| 139 | { | 139 | { |
| 140 | size_t __b = __bos(__s, 0); | 140 | size_t __b = __bos(__s, 0); |
