diff options
| author | Daniel Kolesa | 2022-10-26 00:30:00 +0200 |
|---|---|---|
| committer | jvoisin | 2023-06-25 18:26:45 +0200 |
| commit | fe149628eaae9748be08815d726cc56e8e492c73 (patch) | |
| tree | 252ed41ea13504b67b3c03e648113015b8f85dda /include/sys/select.h | |
| parent | adae76af26e498af6c3004a52a4b1de2c6fd91c3 (diff) | |
add initial clang support
Diffstat (limited to 'include/sys/select.h')
| -rw-r--r-- | include/sys/select.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/sys/select.h b/include/sys/select.h index 1a5afbe..265c7e1 100644 --- a/include/sys/select.h +++ b/include/sys/select.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2015-2016 Dimitris Papastamos <sin@2f30.org> | 2 | * Copyright (C) 2015-2016 Dimitris Papastamos <sin@2f30.org> |
| 3 | * Copyright (C) 2022 q66 <q66@chimera-linux.org> | ||
| 3 | * | 4 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted. | 6 | * purpose with or without fee is hereby granted. |
| @@ -27,8 +28,14 @@ __extension__ | |||
| 27 | extern "C" { | 28 | extern "C" { |
| 28 | #endif | 29 | #endif |
| 29 | 30 | ||
| 31 | #ifdef __clang__ | ||
| 32 | #define _FORTIFY_FD_POS0 const __attribute__((__pass_object_size__(0))) | ||
| 33 | #else | ||
| 34 | #define _FORTIFY_FD_POS0 | ||
| 35 | #endif | ||
| 36 | |||
| 30 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | 37 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) |
| 31 | void __fortify_FD_CLR(int __f, fd_set *__s) | 38 | void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) |
| 32 | { | 39 | { |
| 33 | size_t __b = __bos(__s, 0); | 40 | size_t __b = __bos(__s, 0); |
| 34 | 41 | ||
| @@ -38,7 +45,7 @@ void __fortify_FD_CLR(int __f, fd_set *__s) | |||
| 38 | } | 45 | } |
| 39 | 46 | ||
| 40 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | 47 | static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) |
| 41 | void __fortify_FD_SET(int __f, fd_set *__s) | 48 | void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) |
| 42 | { | 49 | { |
| 43 | size_t __b = __bos(__s, 0); | 50 | size_t __b = __bos(__s, 0); |
| 44 | 51 | ||
| @@ -47,6 +54,8 @@ void __fortify_FD_SET(int __f, fd_set *__s) | |||
| 47 | FD_SET(__f, __s); | 54 | FD_SET(__f, __s); |
| 48 | } | 55 | } |
| 49 | 56 | ||
| 57 | #undef _FORTIFY_FD_POS0 | ||
| 58 | |||
| 50 | #undef FD_CLR | 59 | #undef FD_CLR |
| 51 | #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) | 60 | #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) |
| 52 | #undef FD_SET | 61 | #undef FD_SET |
