From c3d3178b0e14dc1612b397f115d7853200b62146 Mon Sep 17 00:00:00 2001 From: Bruce Cran Date: Sun, 10 Jul 2011 20:56:23 +0200 Subject: [PATCH] Take __weak out of the compiler namespace With Xcode 4 on OS X shipping LLVM by default, I tried building fio with clang and found that the definition of __weak conflicts with something clang defines. I've attached a patch which replaces the double underscores with a single underscore, removing it from the compiler-dependant namespace. Signed-off-by: Jens Axboe --- compiler/compiler.h | 6 +++--- helpers.c | 8 ++++---- helpers.h | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/compiler.h b/compiler/compiler.h index 33500a9b..8dec350b 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -15,11 +15,11 @@ #define uninitialized_var(x) x = x -#ifndef __weak +#ifndef _weak #ifndef __CYGWIN__ -#define __weak __attribute__((weak)) +#define _weak __attribute__((weak)) #else -#define __weak +#define _weak #endif #endif diff --git a/helpers.c b/helpers.c index 377dd02a..1b6dea8e 100644 --- a/helpers.c +++ b/helpers.c @@ -10,18 +10,18 @@ #include "os/os.h" #ifndef __NR_fallocate -int __weak posix_fallocate(int fd, off_t offset, off_t len) +int _weak posix_fallocate(int fd, off_t offset, off_t len) { return 0; } #endif -int __weak inet_aton(const char *cp, struct in_addr *inp) +int _weak inet_aton(const char *cp, struct in_addr *inp) { return 0; } -int __weak clock_gettime(clockid_t clk_id, struct timespec *ts) +int _weak clock_gettime(clockid_t clk_id, struct timespec *ts) { struct timeval tv; int ret; @@ -35,7 +35,7 @@ int __weak clock_gettime(clockid_t clk_id, struct timespec *ts) } #ifndef __NR_sync_file_range -int __weak sync_file_range(int fd, off64_t offset, off64_t nbytes, +int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags) { errno = ENOSYS; diff --git a/helpers.h b/helpers.h index 60729632..7b1ad349 100644 --- a/helpers.h +++ b/helpers.h @@ -7,11 +7,11 @@ struct in_addr; -extern int __weak posix_memalign(void **ptr, size_t align, size_t size); -extern int __weak posix_fallocate(int fd, off_t offset, off_t len); -extern int __weak inet_aton(const char *cp, struct in_addr *inp); -extern int __weak clock_gettime(clockid_t clk_id, struct timespec *ts); -extern int __weak sync_file_range(int fd, off64_t offset, off64_t nbytes, +extern int _weak posix_memalign(void **ptr, size_t align, size_t size); +extern int _weak posix_fallocate(int fd, off_t offset, off_t len); +extern int _weak inet_aton(const char *cp, struct in_addr *inp); +extern int _weak clock_gettime(clockid_t clk_id, struct timespec *ts); +extern int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); #endif /* FIO_HELPERS_H_ */ -- 2.25.1