From f46714c2f9eb13c12c8218f1b7c045182041fdc9 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 26 Oct 2022 00:30:00 +0200 Subject: add initial clang support Co-Authored-By: jvoisin --- include/sys/select.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/sys/select.h') 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 @@ /* * Copyright (C) 2015-2016 Dimitris Papastamos + * Copyright (C) 2022 q66 * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted. @@ -27,8 +28,14 @@ __extension__ extern "C" { #endif +#ifdef __clang__ +#define _FORTIFY_FD_POS0 const __attribute__((__pass_object_size__(0))) +#else +#define _FORTIFY_FD_POS0 +#endif + static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) -void __fortify_FD_CLR(int __f, fd_set *__s) +void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_FD_POS0 __s) { size_t __b = __bos(__s, 0); @@ -38,7 +45,7 @@ void __fortify_FD_CLR(int __f, fd_set *__s) } static __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) -void __fortify_FD_SET(int __f, fd_set *__s) +void __fortify_FD_SET(int __f, fd_set * _FORTIFY_FD_POS0 __s) { size_t __b = __bos(__s, 0); @@ -47,6 +54,8 @@ void __fortify_FD_SET(int __f, fd_set *__s) FD_SET(__f, __s); } +#undef _FORTIFY_FD_POS0 + #undef FD_CLR #define FD_CLR(fd, set) __fortify_FD_CLR(fd, set) #undef FD_SET -- cgit v1.3