diff options
author | 2016-09-06 19:56:36 +0000 | |
---|---|---|
committer | 2016-09-06 19:56:36 +0000 | |
commit | 02cde8906b0cb388f39a2c3520f1da593b271c22 (patch) | |
tree | beddaf9be276a42f920b2eec58c621fcdc56f102 /lib/libc | |
parent | zap bha, hiding outside dev/ tree (diff) | |
download | wireguard-openbsd-02cde8906b0cb388f39a2c3520f1da593b271c22.tar.xz wireguard-openbsd-02cde8906b0cb388f39a2c3520f1da593b271c22.zip |
Make sure attributes are applied to function declarations before they're
used or defined, as clang isn't as forgiving as gcc. Also, declare
__flt_rounds() so that libc can build it despire clang providing its own
<float.h>
ok stefan@ kettenis@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/hidden/ctype.h | 37 | ||||
-rw-r--r-- | lib/libc/hidden/float.h | 7 | ||||
-rw-r--r-- | lib/libc/hidden/signal.h | 24 | ||||
-rw-r--r-- | lib/libc/hidden/stdio.h | 8 |
4 files changed, 58 insertions, 18 deletions
diff --git a/lib/libc/hidden/ctype.h b/lib/libc/hidden/ctype.h index 8d8bda65eb0..36953d86355 100644 --- a/lib/libc/hidden/ctype.h +++ b/lib/libc/hidden/ctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype.h,v 1.2 2015/09/19 04:02:21 guenther Exp $ */ +/* $OpenBSD: ctype.h,v 1.3 2016/09/06 19:56:36 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -18,14 +18,25 @@ #ifndef _LIBC_CTYPE_H_ #define _LIBC_CTYPE_H_ -#include_next <ctype.h> - -#if 0 -extern PROTO_NORMAL(_ctype_); -extern PROTO_NORMAL(_tolower_tab_); -extern PROTO_NORMAL(_toupper_tab_); -#endif - +/* sigh: predeclare and rename the functions which we'll declare inline */ +__only_inline int isalnum(int _c); +__only_inline int isalpha(int _c); +__only_inline int iscntrl(int _c); +__only_inline int isdigit(int _c); +__only_inline int isgraph(int _c); +__only_inline int islower(int _c); +__only_inline int isprint(int _c); +__only_inline int ispunct(int _c); +__only_inline int isspace(int _c); +__only_inline int isupper(int _c); +__only_inline int isxdigit(int _c); +__only_inline int tolower(int _c); +__only_inline int toupper(int _c); +__only_inline int isblank(int _c); +__only_inline int isascii(int _c); +__only_inline int toascii(int _c); +__only_inline int _tolower(int _c); +__only_inline int _toupper(int _c); PROTO_NORMAL(isalnum); PROTO_NORMAL(isalpha); PROTO_NORMAL(iscntrl); @@ -45,4 +56,12 @@ PROTO_DEPRECATED(toascii); PROTO_STD_DEPRECATED(_tolower); PROTO_STD_DEPRECATED(_toupper); +#include_next <ctype.h> + +#if 0 +extern PROTO_NORMAL(_ctype_); +extern PROTO_NORMAL(_tolower_tab_); +extern PROTO_NORMAL(_toupper_tab_); +#endif + #endif /* !_LIBC_CTYPE_H_ */ diff --git a/lib/libc/hidden/float.h b/lib/libc/hidden/float.h index ea2cf5bae9a..82d2aca3445 100644 --- a/lib/libc/hidden/float.h +++ b/lib/libc/hidden/float.h @@ -1,4 +1,4 @@ -/* $OpenBSD: float.h,v 1.1 2015/10/27 05:54:49 guenther Exp $ */ +/* $OpenBSD: float.h,v 1.2 2016/09/06 19:56:36 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -20,6 +20,11 @@ #include_next <float.h> +/* + * clang overrides our <float.h>, but libc still need to define __flt_rounds() + * to support building with gcc + */ +int __flt_rounds(void); PROTO_NORMAL(__flt_rounds); #endif /* _LIBC_FLOAT_H_ */ diff --git a/lib/libc/hidden/signal.h b/lib/libc/hidden/signal.h index e13485a4f0d..a7677134c48 100644 --- a/lib/libc/hidden/signal.h +++ b/lib/libc/hidden/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.12 2016/05/09 23:55:52 guenther Exp $ */ +/* $OpenBSD: signal.h,v 1.13 2016/09/06 19:56:36 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -18,6 +18,23 @@ #ifndef _LIBC_SIGNAL_H #define _LIBC_SIGNAL_H +/* Rename __errno() before it's used in the inline functions in <signal.h> */ +#include <errno.h> + +/* sigh: predeclare and rename the functions which we'll declare inline */ +#include <sys/signal.h> + +__only_inline int sigaddset(sigset_t *__set, int __signo); +__only_inline int sigdelset(sigset_t *__set, int __signo); +__only_inline int sigemptyset(sigset_t *__set); +__only_inline int sigfillset(sigset_t *__set); +__only_inline int sigismember(const sigset_t *__set, int __signo); +PROTO_NORMAL(sigaddset); +PROTO_NORMAL(sigdelset); +PROTO_NORMAL(sigemptyset); +PROTO_NORMAL(sigfillset); +PROTO_NORMAL(sigismember); + #include_next <signal.h> __BEGIN_HIDDEN_DECLS @@ -39,14 +56,9 @@ PROTO_DEPRECATED(psignal); PROTO_DEPRECATED(pthread_sigmask); PROTO_NORMAL(raise); PROTO_WRAP(sigaction); -PROTO_NORMAL(sigaddset); PROTO_NORMAL(sigaltstack); PROTO_NORMAL(sigblock); -PROTO_NORMAL(sigdelset); -PROTO_NORMAL(sigemptyset); -PROTO_NORMAL(sigfillset); PROTO_DEPRECATED(siginterrupt); -PROTO_NORMAL(sigismember); PROTO_STD_DEPRECATED(signal); PROTO_DEPRECATED(sigpause); PROTO_NORMAL(sigpending); diff --git a/lib/libc/hidden/stdio.h b/lib/libc/hidden/stdio.h index 1240a3a0bf3..6b03f7ac54e 100644 --- a/lib/libc/hidden/stdio.h +++ b/lib/libc/hidden/stdio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdio.h,v 1.6 2016/05/07 19:05:22 guenther Exp $ */ +/* $OpenBSD: stdio.h,v 1.7 2016/09/06 19:56:36 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -18,6 +18,11 @@ #ifndef _LIBC_STDIO_H_ #define _LIBC_STDIO_H_ +/* Rename __swbuf() before it's used in the inline __sputc() */ +struct __sFILE; +int __swbuf(int, struct __sFILE *); +PROTO_NORMAL(__swbuf); + /* we want the const-correct declarations inside libc */ #define __SYS_ERRLIST @@ -36,7 +41,6 @@ extern PROTO_NORMAL(sys_errlist); #endif PROTO_NORMAL(__srget); -PROTO_NORMAL(__swbuf); PROTO_NORMAL(asprintf); PROTO_NORMAL(clearerr); PROTO_NORMAL(ctermid); |