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 <jaxboe@fusionio.com>
#define uninitialized_var(x) x = x
#define uninitialized_var(x) x = x
-#define __weak __attribute__((weak))
+#define _weak __attribute__((weak))
#include "os/os.h"
#ifndef __NR_fallocate
#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)
-int __weak inet_aton(const char *cp, struct in_addr *inp)
+int _weak inet_aton(const char *cp, struct in_addr *inp)
-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;
{
struct timeval tv;
int ret;
}
#ifndef __NR_sync_file_range
}
#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;
unsigned int flags)
{
errno = ENOSYS;
-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_ */
unsigned int flags);
#endif /* FIO_HELPERS_H_ */