From 2c610a26730540ff917cf83dd9dc5387184001b2 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 22 Aug 2023 20:08:52 +0200 Subject: 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 --- include/stdio.h | 2 -- 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, return __r; } -#if defined(__has_builtin) #if __has_builtin(__builtin_va_arg_pack) /* 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, ...) } #endif /* __has_builtin(__builtin_va_arg_pack) */ -#endif /* defined(__has_builtin) */ #ifdef __cplusplus } 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__ extern "C" { #endif -#ifdef __clang__ -#define _FORTIFY_FD_POS0 const __attribute__((__pass_object_size__(0))) -#else -#define _FORTIFY_FD_POS0 -#endif +#define _STI static __inline__ \ + __attribute__((__always_inline__,__gnu_inline__,__artificial__)) -static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) -void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) +_STI void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_POS0 __s) { size_t __b = __bos(__s, 0); @@ -44,8 +40,7 @@ void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) FD_CLR(__f, __s); } -static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) -void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) +_STI void __fortify_FD_SET(int __f, fd_set * _FORTIFY_POS0 __s) { size_t __b = __bos(__s, 0); @@ -54,7 +49,7 @@ void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) FD_SET(__f, __s); } -#undef _FORTIFY_FD_POS0 +#undef _STI #undef FD_CLR #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) -- cgit v1.3