--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -61,7 +61,7 @@
 #   include <sys/types.h>
 #endif
 
-#if defined(__linux) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
+#if defined(__linux__) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
 #   include <grp.h> // for initgroups
 #endif
 
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -46,7 +46,7 @@
 #   include <sys/ioctl.h>
 #endif
 
-#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
 #  include <ifaddrs.h>
 #elif defined(__sun)
 #  include <sys/sockio.h>
@@ -346,7 +346,7 @@
 
         free(adapter_addresses);
     }
-#elif defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
     struct ifaddrs* ifap;
     if(::getifaddrs(&ifap) == SOCKET_ERROR)
     {
@@ -648,7 +648,7 @@
     //
     if(isAddr)
     {
-#  if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+#  if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
         struct ifaddrs* ifap;
         if(::getifaddrs(&ifap) != SOCKET_ERROR)
         {
@@ -2653,7 +2653,7 @@
         }
     }
 
-#if defined(__linux)
+#if defined(__linux__)
     //
     // Prevent self connect (self connect happens on Linux when a client tries to connect to
     // a server which was just deactivated if the client socket re-uses the same ephemeral
@@ -2722,7 +2722,7 @@
         }
     }
 
-#if defined(__linux)
+#if defined(__linux__)
     //
     // Prevent self connect (self connect happens on Linux when a client tries to connect to
     // a server which was just deactivated if the client socket re-uses the same ephemeral
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -32,7 +32,7 @@
 #endif
 #endif
 
-#if defined(__linux) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
+#if defined(__linux__) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
 #   include <grp.h> // for setgroups
 #endif
 
@@ -1413,7 +1413,7 @@
     try
     {
         int status;
-#if defined(__linux)
+#if defined(__linux__)
         int nRetry = 0;
         while(true) // The while loop is necessary for the linux workaround.
         {
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -333,7 +333,7 @@
     {
 #if defined(_WIN32)
         _nProcessorSockets = getSocketCount(_traceLevels->logger);
-#elif defined(__linux)
+#elif defined(__linux__)
         ifstream is("/proc/cpuinfo");
         set<string> ids;
 
@@ -484,7 +484,7 @@
     info.avg1 = static_cast<float>(_last1Total) / _usages1.size() / 100.0f;
     info.avg5 = static_cast<float>(_last5Total) / _usages5.size() / 100.0f;
     info.avg15 = static_cast<float>(_last15Total) / _usages15.size() / 100.0f;
-#elif defined(__sun) || defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__sun) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
     //
     // We use the load average divided by the number of
     // processors to figure out if the machine is busy or
--- a/cpp/src/IceSSL/OpenSSLEngine.cpp
+++ b/cpp/src/IceSSL/OpenSSLEngine.cpp
@@ -84,7 +84,7 @@
     // On some platforms, pthread_t is a pointer to a per-thread structure.
     //
     return reinterpret_cast<unsigned long>(pthread_self());
-#  elif defined(__linux) || defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__GLIBC__)
+#  elif defined(__linux__) || defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__GLIBC__)
     //
     // On Linux, Solaris, HP-UX and AIX, pthread_t is an integer.
     //
--- a/cpp/include/IceUtil/Atomic.h
+++ b/cpp/include/IceUtil/Atomic.h
@@ -23,7 +23,7 @@
 #elif ((defined(__GNUC__) && (((__GNUC__* 100) + __GNUC_MINOR__) >= 401)) || __clang__)  &&                         \
         ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \
          defined(__APPLE__) || \
-        (defined(__linux) && \
+        (defined(__linux__) && \
                 (defined(__i486) || defined(__i586) || \
                  defined(__i686) || defined(__x86_64))))
 
--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -80,7 +80,7 @@
 #   elif defined(__WORDSIZE) && (__WORDSIZE == 32)
 #      define ICE_32
 #   elif defined(__sun) && (defined(__sparcv9) || defined(__x86_64))  || \
-         defined(__linux) && defined(__x86_64)                        || \
+         defined(__linux__) && defined(__x86_64)                      || \
          defined(__APPLE__) && defined(__x86_64)                      || \
          defined(__hppa) && defined(__LP64__)                         || \
          defined(_ARCH_COM) && defined(__64BIT__)                     || \
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -38,7 +38,7 @@
 #   include <netdb.h>
 #endif
 
-#if defined(__linux) && !defined(ICE_NO_EPOLL)
+#if defined(__linux__) && !defined(ICE_NO_EPOLL)
 #   define ICE_USE_EPOLL 1
 #elif (defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && TARGET_OS_IPHONE == 0 && !defined(ICE_NO_KQUEUE)
 #   define ICE_USE_KQUEUE 1
