Restore C++ support
This commit is contained in:
parent
c4abf4497b
commit
d12254166a
2
README
2
README
|
@ -6,8 +6,6 @@ and simply overlays the system headers by using the #include_next extension foun
|
|||
in GCC and clang. It was initially intended to be used on musl[1] based Linux
|
||||
distributions.
|
||||
|
||||
NOTE: It does *not* support C++. For C++ programs, the fortify headers
|
||||
will essentially be a no-op.
|
||||
|
||||
Features
|
||||
========
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef poll
|
||||
|
||||
extern int __poll_orig(struct pollfd *, nfds_t, int)
|
||||
|
@ -35,6 +38,8 @@ int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef fgets
|
||||
#undef fread
|
||||
#undef fwrite
|
||||
|
@ -114,6 +117,8 @@ int sprintf(char *s, const char *fmt, ...)
|
|||
return r;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#undef realpath
|
||||
|
@ -33,6 +35,8 @@ char *realpath(const char *path, char *resolved)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef memcpy
|
||||
#undef memmove
|
||||
#undef memset
|
||||
|
@ -181,6 +184,8 @@ size_t strlcpy(char *dest, const char *src, size_t n)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
|
||||
|| (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
|
||||
|
@ -37,6 +39,8 @@ void bzero(void *src, size_t n)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static __inline __attribute__((__always_inline__,__gnu_inline__))
|
||||
int __fortify_FD_CLR(int fd, fd_set *set)
|
||||
|
@ -32,6 +34,8 @@ int __fortify_FD_SET(int fd, fd_set *set)
|
|||
#undef FD_SET
|
||||
#define FD_SET(fd, set) __fortify_FD_SET(fd, set)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef send
|
||||
|
@ -61,6 +64,8 @@ ssize_t sendto(int sockfd, const void *buf, size_t n, int flags,
|
|||
return __sendto_orig(sockfd, buf, n, flags, sa, salen);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef confstr
|
||||
#undef getcwd
|
||||
#undef getgroups
|
||||
|
@ -165,6 +168,8 @@ ssize_t write(int fd, const void *buf, size_t n)
|
|||
return __write_orig(fd, buf, n);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef fgetws
|
||||
#undef mbsnrtowcs
|
||||
#undef mbsrtowcs
|
||||
|
@ -246,6 +249,8 @@ wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n)
|
|||
return __wmemset_orig(s, c, n);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue