From 85064d3d24c90a3b836c2c3280ad38761943450b Mon Sep 17 00:00:00 2001 From: Peter Griess Date: Mon, 7 Oct 2013 08:38:11 -0700 Subject: [PATCH] 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 --- folly/FileUtil.cpp | 4 ++-- folly/FileUtil.h | 4 ++-- folly/Malloc.h | 2 +- folly/Portability.h | 4 ++-- folly/io/RecordIO.cpp | 2 +- folly/small_vector.h | 4 ++-- folly/test/FileUtilTest.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/folly/FileUtil.cpp b/folly/FileUtil.cpp index 0c719a87..2977757f 100644 --- a/folly/FileUtil.cpp +++ b/folly/FileUtil.cpp @@ -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); } diff --git a/folly/FileUtil.h b/folly/FileUtil.h index 93b843bf..6b9325ae 100644 --- a/folly/FileUtil.h +++ b/folly/FileUtil.h @@ -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 diff --git a/folly/Malloc.h b/folly/Malloc.h index 94a172b3..f7c94ca1 100644 --- a/folly/Malloc.h +++ b/folly/Malloc.h @@ -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 #else #include diff --git a/folly/Portability.h b/folly/Portability.h index fe38d6b5..1095164f 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -21,12 +21,12 @@ #include "folly-config.h" #endif -#ifdef FOLLY_HAVE_FEATURES_H +#if FOLLY_HAVE_FEATURES_H #include #endif -#ifdef FOLLY_HAVE_SCHED_H +#if FOLLY_HAVE_SCHED_H #include #ifndef FOLLY_HAVE_PTHREAD_YIELD #define pthread_yield sched_yield diff --git a/folly/io/RecordIO.cpp b/folly/io/RecordIO.cpp index a4075057..9dcf3c91 100644 --- a/folly/io/RecordIO.cpp +++ b/folly/io/RecordIO.cpp @@ -56,7 +56,7 @@ void RecordIOWriter::write(std::unique_ptr 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 diff --git a/folly/small_vector.h b/folly/small_vector.h index ed2c44f1..373b8393 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -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 diff --git a/folly/test/FileUtilTest.cpp b/folly/test/FileUtilTest.cpp index b35a3abe..f466f11f 100644 --- a/folly/test/FileUtilTest.cpp +++ b/folly/test/FileUtilTest.cpp @@ -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}); -- 2.34.1