Commit 85064d3d authored by Peter Griess's avatar Peter Griess

Use #if rather than #ifdef to check autoconf guards.

Summary:
- Replace instances of '#ifdef FOLLY_*' guards with '#if FOLLY_*'. This
allows the configuration system to disable the guard by defining the
value to 0 using the -D compiler flag.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: delong.j@fb.com

FB internal diff: D999129
parent 6f335237
......@@ -132,7 +132,7 @@ ssize_t readvFull(int fd, iovec* iov, int count) {
return wrapvFull(readv, fd, iov, count);
}
#ifdef FOLLY_HAVE_PREADV
#if FOLLY_HAVE_PREADV
ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset) {
return wrapvFull(preadv, fd, iov, count, offset);
}
......@@ -142,7 +142,7 @@ ssize_t writevFull(int fd, iovec* iov, int count) {
return wrapvFull(writev, fd, iov, count);
}
#ifdef FOLLY_HAVE_PWRITEV
#if FOLLY_HAVE_PWRITEV
ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset) {
return wrapvFull(pwritev, fd, iov, count, offset);
}
......
......@@ -77,7 +77,7 @@ ssize_t writevNoInt(int fd, const iovec* iov, int count);
ssize_t readFull(int fd, void* buf, size_t n);
ssize_t preadFull(int fd, void* buf, size_t n, off_t offset);
ssize_t readvFull(int fd, iovec* iov, int count);
#ifdef FOLLY_HAVE_PREADV
#if FOLLY_HAVE_PREADV
ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset);
#endif
......@@ -98,7 +98,7 @@ ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset);
ssize_t writeFull(int fd, const void* buf, size_t n);
ssize_t pwriteFull(int fd, const void* buf, size_t n, off_t offset);
ssize_t writevFull(int fd, iovec* iov, int count);
#ifdef FOLLY_HAVE_PWRITEV
#if FOLLY_HAVE_PWRITEV
ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset);
#endif
......
......@@ -49,7 +49,7 @@ namespace folly {
// for malloc_usable_size
// NOTE: FreeBSD 9 doesn't have malloc.h. It's defitions
// are found in stdlib.h.
#ifdef FOLLY_HAVE_MALLOC_H
#if FOLLY_HAVE_MALLOC_H
#include <malloc.h>
#else
#include <stdlib.h>
......
......@@ -21,12 +21,12 @@
#include "folly-config.h"
#endif
#ifdef FOLLY_HAVE_FEATURES_H
#if FOLLY_HAVE_FEATURES_H
#include <features.h>
#endif
#ifdef FOLLY_HAVE_SCHED_H
#if FOLLY_HAVE_SCHED_H
#include <sched.h>
#ifndef FOLLY_HAVE_PTHREAD_YIELD
#define pthread_yield sched_yield
......
......@@ -56,7 +56,7 @@ void RecordIOWriter::write(std::unique_ptr<IOBuf> buf) {
// We're going to write. Reserve space for ourselves.
off_t pos = filePos_.fetch_add(totalLength);
#ifdef FOLLY_HAVE_PWRITEV
#if FOLLY_HAVE_PWRITEV
auto iov = buf->getIov();
ssize_t bytes = pwritevFull(file_.fd(), iov.data(), iov.size(), pos);
#else
......
......@@ -54,9 +54,9 @@
# define FB_PACKED
#endif
#ifdef FOLLY_HAVE_MALLOC_SIZE
#if FOLLY_HAVE_MALLOC_SIZE
extern "C" std::size_t malloc_size(const void*);
# ifndef FOLLY_HAVE_MALLOC_USABLE_SIZE
# if !FOLLY_HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size malloc_size
# endif
# ifndef malloc_usable_size
......
......@@ -222,7 +222,7 @@ TEST_F(FileUtilTest, readv) {
}
}
#ifdef FOLLY_HAVE_PREADV
#if FOLLY_HAVE_PREADV
TEST_F(FileUtilTest, preadv) {
for (auto& p : readers_) {
IovecBuffers buf({12, 19, 31});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment