Use #if rather than #ifdef to check HAVE_* macros.

This commit is contained in:
Gunnar Beutner 2013-02-14 10:55:15 +01:00
parent 9412b2be35
commit 49576d3a82
3 changed files with 9 additions and 9 deletions

View File

@ -166,7 +166,7 @@ namespace tuples = boost::tuples;
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#ifdef HAVE_GCC_ABI_DEMANGLE #if HAVE_GCC_ABI_DEMANGLE
# include <cxxabi.h> # include <cxxabi.h>
#endif /* HAVE_GCC_ABI_DEMANGLE */ #endif /* HAVE_GCC_ABI_DEMANGLE */

View File

@ -30,7 +30,7 @@ void Process::CreateWorkers(void)
{ {
int fds[2]; int fds[2];
#ifdef HAVE_PIPE2 #if HAVE_PIPE2
if (pipe2(fds, O_CLOEXEC) < 0) if (pipe2(fds, O_CLOEXEC) < 0)
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno)); BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
#else /* HAVE_PIPE2 */ #else /* HAVE_PIPE2 */
@ -172,7 +172,7 @@ void Process::InitTask(void)
int fds[2]; int fds[2];
#ifdef HAVE_PIPE2 #if HAVE_PIPE2
if (pipe2(fds, O_NONBLOCK | O_CLOEXEC) < 0) if (pipe2(fds, O_NONBLOCK | O_CLOEXEC) < 0)
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno)); BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
#else /* HAVE_PIPE2 */ #else /* HAVE_PIPE2 */
@ -223,11 +223,11 @@ void Process::InitTask(void)
m_ExtraEnvironment.reset(); m_ExtraEnvironment.reset();
#ifdef HAVE_VFORK #if HAVE_WORKING_VFORK
m_Pid = vfork(); m_Pid = vfork();
#else /* HAVE_VFORK */ #else /* HAVE_WORKING_VFORK */
m_Pid = fork(); m_Pid = fork();
#endif /* HAVE_VFORK */ #endif /* HAVE_WORKING_VFORK */
if (m_Pid < 0) if (m_Pid < 0)
BOOST_THROW_EXCEPTION(PosixException("fork() failed.", errno)); BOOST_THROW_EXCEPTION(PosixException("fork() failed.", errno));

View File

@ -19,7 +19,7 @@
#include "i2-base.h" #include "i2-base.h"
#include <mmatch.h> #include <mmatch.h>
#ifdef HAVE_BACKTRACE_SYMBOLS #if HAVE_BACKTRACE_SYMBOLS
# include <execinfo.h> # include <execinfo.h>
#endif /* HAVE_BACKTRACE_SYMBOLS */ #endif /* HAVE_BACKTRACE_SYMBOLS */
@ -37,7 +37,7 @@ String Utility::DemangleSymbolName(const String& sym)
{ {
String result = sym; String result = sym;
#ifdef HAVE_GCC_ABI_DEMANGLE #if HAVE_GCC_ABI_DEMANGLE
int status; int status;
char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status); char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status);
@ -71,7 +71,7 @@ String Utility::GetTypeName(const type_info& ti)
*/ */
bool Utility::PrintStacktrace(ostream& fp, int ignoreFrames) bool Utility::PrintStacktrace(ostream& fp, int ignoreFrames)
{ {
#ifdef HAVE_BACKTRACE_SYMBOLS #if HAVE_BACKTRACE_SYMBOLS
void *frames[50]; void *frames[50];
int framecount = backtrace(frames, sizeof(frames) / sizeof(frames[0])); int framecount = backtrace(frames, sizeof(frames) / sizeof(frames[0]));