From 8604f138c55ab4904a2fd9b7edce2b688c70e6c0 Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 11 Mar 2015 09:26:11 +0000 Subject: [PATCH] Add ifdef guards for C++ code --- include/poll.h | 8 ++++++++ include/stdio.h | 8 ++++++++ include/stdlib.h | 8 ++++++++ include/string.h | 8 ++++++++ include/strings.h | 8 ++++++++ include/sys/select.h | 8 ++++++++ include/sys/socket.h | 8 ++++++++ include/unistd.h | 8 ++++++++ include/wchar.h | 8 ++++++++ 9 files changed, 72 insertions(+) diff --git a/include/poll.h b/include/poll.h index 2f06045..ac79695 100644 --- a/include/poll.h +++ b/include/poll.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) int __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout) @@ -38,6 +42,10 @@ __fortify_ppoll(struct pollfd *fds, nfds_t nfds, #define ppoll(fds, nfds, timeout, mask) __fortify_ppoll(fds, nfds, timeout, mask) #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/stdio.h b/include/stdio.h index b1ccc75..ab9b00f 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) char * __fortify_fgets(char *s, int n, FILE *fp) @@ -104,6 +108,10 @@ __fortify_vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) r; \ }) +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/stdlib.h b/include/stdlib.h index 35bff81..312555c 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -9,6 +9,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) static inline __attribute__ ((always_inline)) char * @@ -32,6 +36,10 @@ __fortify_realpath(const char *path, char *resolved) #define realpath(path, resolved) __fortify_realpath(path, resolved) #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/string.h b/include/string.h index 9f7d462..2f513ca 100644 --- a/include/string.h +++ b/include/string.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) void * __fortify_memcpy(void *dest, const void *src, size_t n) @@ -186,6 +190,10 @@ __fortify_strlcpy(char *dest, const char *src, size_t n) #define strlcpy(dest, src, n) __fortify_strlcpy(dest, src, n) #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/strings.h b/include/strings.h index 943b565..0862b58 100644 --- a/include/strings.h +++ b/include/strings.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) @@ -36,6 +40,10 @@ __fortify_bzero(void *src, size_t n) #define bzero(src, n) __fortify_bzero(src, n) #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/sys/select.h b/include/sys/select.h index 9101b51..50bdb6a 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) int __fortify_FD_CLR(int fd, fd_set *set) @@ -32,6 +36,10 @@ __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 #endif diff --git a/include/sys/socket.h b/include/sys/socket.h index 7044f65..fc7381a 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) ssize_t __fortify_recv(int sockfd, void *buf, size_t n, int flags) @@ -60,6 +64,10 @@ __fortify_sendto(int sockfd, const void *buf, size_t n, int flags, #undef sendto #define sendto(sockfd, buf, n, flags, sa, salen) __fortify_sendto(sockfd, buf, n, flags, sa, salen) +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/unistd.h b/include/unistd.h index 6b502b5..2403db1 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -5,6 +5,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) size_t __fortify_confstr(int name, char *buf, size_t len) @@ -168,6 +172,10 @@ __fortify_write(int fd, const void *buf, size_t n) #undef write #define write(fd, buf, n) __fortify_write(fd, buf, n) +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/include/wchar.h b/include/wchar.h index ca9840a..8a72e35 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -6,6 +6,10 @@ #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 +#ifdef __cplusplus +extern "C" { +#endif + static inline __attribute__ ((always_inline)) wchar_t * __fortify_fgetws(wchar_t *s, int n, FILE *fp) @@ -249,6 +253,10 @@ __fortify_wmemset(wchar_t *s, wchar_t c, size_t n) #undef wmemset #define wmemset(s, c, n) __fortify_wmemset(s, c, n) +#ifdef __cplusplus +} +#endif + #endif #endif