diff options
| author | jvoisin | 2023-08-22 20:08:52 +0200 |
|---|---|---|
| committer | jvoisin | 2023-08-22 20:08:52 +0200 |
| commit | 2c610a26730540ff917cf83dd9dc5387184001b2 (patch) | |
| tree | c80a9fa0791645d98ef48d3d6a4bebfa3b89b4d4 | |
| parent | f3ff539ee4d739d704415f3ff17d72a822bb3d9b (diff) | |
Clean up some includes
- Remove a superfluous `#if defined(__has_builtin)` since it's already
accounted for in include/fortify-headers.h
- Replace `_FORTIFY_FD_POS0` with the already existing `_FORTIFY_POS0`
- Factorise some duplicate code into a macro
| -rw-r--r-- | include/stdio.h | 2 | ||||
| -rw-r--r-- | include/sys/select.h | 15 |
2 files changed, 5 insertions, 12 deletions
diff --git a/include/stdio.h b/include/stdio.h index 1b244f4..9d29e94 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
| @@ -153,7 +153,6 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, | |||
| 153 | return __r; | 153 | return __r; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | #if defined(__has_builtin) | ||
| 157 | #if __has_builtin(__builtin_va_arg_pack) | 156 | #if __has_builtin(__builtin_va_arg_pack) |
| 158 | 157 | ||
| 159 | /* clang is missing __builtin_va_arg_pack, so we cannot use these impls | 158 | /* clang is missing __builtin_va_arg_pack, so we cannot use these impls |
| @@ -203,7 +202,6 @@ _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) | |||
| 203 | } | 202 | } |
| 204 | 203 | ||
| 205 | #endif /* __has_builtin(__builtin_va_arg_pack) */ | 204 | #endif /* __has_builtin(__builtin_va_arg_pack) */ |
| 206 | #endif /* defined(__has_builtin) */ | ||
| 207 | 205 | ||
| 208 | #ifdef __cplusplus | 206 | #ifdef __cplusplus |
| 209 | } | 207 | } |
diff --git a/include/sys/select.h b/include/sys/select.h index 265c7e1..df32003 100644 --- a/include/sys/select.h +++ b/include/sys/select.h | |||
| @@ -28,14 +28,10 @@ __extension__ | |||
| 28 | extern "C" { | 28 | extern "C" { |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #ifdef __clang__ | 31 | #define _STI static __inline__ \ |
| 32 | #define _FORTIFY_FD_POS0 const __attribute__((__pass_object_size__(0))) | 32 | __attribute__((__always_inline__,__gnu_inline__,__artificial__)) |
| 33 | #else | ||
| 34 | #define _FORTIFY_FD_POS0 | ||
| 35 | #endif | ||
| 36 | 33 | ||
| 37 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | 34 | _STI void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_POS0 __s) |
| 38 | void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) | ||
| 39 | { | 35 | { |
| 40 | size_t __b = __bos(__s, 0); | 36 | size_t __b = __bos(__s, 0); |
| 41 | 37 | ||
| @@ -44,8 +40,7 @@ void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) | |||
| 44 | FD_CLR(__f, __s); | 40 | FD_CLR(__f, __s); |
| 45 | } | 41 | } |
| 46 | 42 | ||
| 47 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | 43 | _STI void __fortify_FD_SET(int __f, fd_set * _FORTIFY_POS0 __s) |
| 48 | void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) | ||
| 49 | { | 44 | { |
| 50 | size_t __b = __bos(__s, 0); | 45 | size_t __b = __bos(__s, 0); |
| 51 | 46 | ||
| @@ -54,7 +49,7 @@ void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) | |||
| 54 | FD_SET(__f, __s); | 49 | FD_SET(__f, __s); |
| 55 | } | 50 | } |
| 56 | 51 | ||
| 57 | #undef _FORTIFY_FD_POS0 | 52 | #undef _STI |
| 58 | 53 | ||
| 59 | #undef FD_CLR | 54 | #undef FD_CLR |
| 60 | #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) | 55 | #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) |
