diff --git a/src/Flare.cc b/src/Flare.cc index 0ab45b7452..99ac2d6ede 100644 --- a/src/Flare.cc +++ b/src/Flare.cc @@ -8,7 +8,7 @@ #include "zeek/Reporter.h" -#if defined(_MSC_VER) +#ifdef _MSC_VER #include @@ -31,10 +31,8 @@ namespace zeek::detail { Flare::Flare() -#if ! defined(_MSC_VER) - : pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK) - { - } +#ifndef _MSC_VER + : pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK){} #else { WSADATA wsaData; @@ -64,7 +62,7 @@ Flare::Flare() } #endif -[[noreturn]] static void bad_pipe_op(const char* which, bool signal_safe) + [[noreturn]] static void bad_pipe_op(const char* which, bool signal_safe) { if ( signal_safe ) abort(); @@ -87,7 +85,7 @@ void Flare::Fire(bool signal_safe) for ( ;; ) { -#if ! defined(_MSC_VER) +#ifndef _MSC_VER int n = write(pipe.WriteFD(), &tmp, 1); #else @@ -99,7 +97,7 @@ void Flare::Fire(bool signal_safe) if ( n < 0 ) { -#if defined(_MSC_VER) +#ifdef _MSC_VER errno = WSAGetLastError(); bad_pipe_op("send", signal_safe); #endif @@ -125,7 +123,7 @@ int Flare::Extinguish(bool signal_safe) for ( ;; ) { -#if ! defined(_MSC_VER) +#ifndef _MSC_VER int n = read(pipe.ReadFD(), &tmp, sizeof(tmp)); #else int n = recv(recvfd, tmp, sizeof(tmp), 0); @@ -136,7 +134,7 @@ int Flare::Extinguish(bool signal_safe) // Pipe may not be empty yet: try again. continue; } -#if defined(_MSC_VER) +#ifdef _MSC_VER if ( WSAGetLastError() == WSAEWOULDBLOCK ) break; errno = WSAGetLastError(); diff --git a/src/Flare.h b/src/Flare.h index 6ded8af25e..affae42dfd 100644 --- a/src/Flare.h +++ b/src/Flare.h @@ -2,7 +2,7 @@ #pragma once -#if ! defined(_MSC_VER) +#ifndef _MSC_VER #include "Pipe.h" #endif @@ -25,7 +25,7 @@ public: * Fire()'d and not yet Extinguished()'d. */ int FD() const -#if ! defined(_MSC_VER) +#ifndef _MSC_VER { return pipe.ReadFD(); } @@ -52,7 +52,7 @@ public: int Extinguish(bool signal_safe = false); private: -#if ! defined(_MSC_VER) +#ifndef _MSC_VER Pipe pipe; #else int sendfd, recvfd; diff --git a/src/main.cc b/src/main.cc index 2796ebf1ad..1de09fc9e7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -9,13 +9,13 @@ #include "zeek/supervisor/Supervisor.h" #include "zeek/zeek-setup.h" -#if defined(_MSC_VER) +#ifdef _MSC_VER #include // For _O_BINARY. #endif int main(int argc, char** argv) { -#if defined(_MSC_VER) +#ifdef _MSC_VER _setmode(_fileno(stdout), _O_BINARY); _setmode(_fileno(stderr), _O_BINARY); #endif diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 7828af3656..a535d0f43e 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -3,7 +3,7 @@ #include "zeek/plugin/Manager.h" #include -#if ! defined(_MSC_VER) +#ifndef _MSC_VER #include #include #endif @@ -163,7 +163,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ std::vector* errors) { // Loading dynamic plugins is not currently supported on Windows platform. -#if defined(_MSC_VER) +#ifdef _MSC_VER return false; #else errors->clear(); // caller should pass it in empty, but just to be sure diff --git a/src/plugin/Plugin.h b/src/plugin/Plugin.h index 333df81538..415bc867ae 100644 --- a/src/plugin/Plugin.h +++ b/src/plugin/Plugin.h @@ -25,7 +25,7 @@ struct Field; namespace zeek { -#if defined(_MSC_VER) +#ifdef _MSC_VER #undef VOID #endif diff --git a/src/util.cc b/src/util.cc index bc85bb166e..ca17648fc1 100644 --- a/src/util.cc +++ b/src/util.cc @@ -2539,7 +2539,7 @@ static void strerror_r_helper(int result, char* buf, size_t buflen) void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen) { -#if defined(_MSC_VER) +#ifdef _MSC_VER auto str = "Error number: " + std::to_string(zeek_errno); auto res = str.data(); #else