Replace all uses of __LINUX__ with the lower case
authorGeunsik Lim <geunsik.lim@samsung.com>
Sat, 5 Mar 2016 03:05:12 +0000 (12:05 +0900)
committerGeunsik Lim <geunsik.lim@samsung.com>
Sat, 5 Mar 2016 03:05:12 +0000 (12:05 +0900)
According to https://sourceforge.net/p/predef/wiki/OperatingSystems/
(Pre-defined Compiler Macros) and http://www.faqs.org/docs/Linux-HOWTO/GCC-HOWTO.html
(Porting and compiling:Automatically defined symbols), the __linux__ marcro is the
right way to detect systems based on the Linux kernel and is the POSIX compliant.

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/6f7aa7967c607b8c667518314ab937c0d7547025

14 files changed:
src/coreclr/CMakeLists.txt
src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
src/coreclr/src/inc/pedecoder.h
src/coreclr/src/pal/inc/pal.h
src/coreclr/src/pal/inc/pal_mstypes.h
src/coreclr/src/pal/src/CMakeLists.txt
src/coreclr/src/pal/src/exception/seh-unwind.cpp
src/coreclr/src/pal/src/exception/seh.cpp
src/coreclr/src/pal/src/include/pal/thread.hpp
src/coreclr/src/pal/src/init/pal.cpp
src/coreclr/src/pal/src/loader/module.cpp
src/coreclr/src/pal/src/misc/sysinfo.cpp
src/coreclr/src/pal/src/misc/tracepointprovider.cpp
src/coreclr/src/pal/tests/CMakeLists.txt

index 20a167e..4815662 100644 (file)
@@ -293,7 +293,6 @@ if (CLR_CMAKE_PLATFORM_UNIX)
   add_definitions(-DPLATFORM_UNIX=1)
 
   if(CLR_CMAKE_PLATFORM_LINUX)
-    add_definitions(-D__LINUX__=1)
     if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
       message("Detected Linux x86_64")
       add_definitions(-DLINUX64)
index e3eaf48..bc795fd 100644 (file)
@@ -53,7 +53,7 @@ typedef int (*ExecuteAssemblyFunction)(
             const char* managedAssemblyPath,
             unsigned int* exitCode);
 
-#if defined(__LINUX__)
+#if defined(__linux__)
 #define symlinkEntrypointExecutable "/proc/self/exe"
 #elif !defined(__APPLE__)
 #define symlinkEntrypointExecutable "/proc/curproc/exe"
@@ -67,7 +67,7 @@ bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable)
 
     // Get path to the executable for the current process using
     // platform specific means.
-#if defined(__LINUX__)
+#if defined(__linux__)
     // On Linux, fetch the entry point EXE absolute path, inclusive of filename.
     char exe[PATH_MAX];
     ssize_t res = readlink(symlinkEntrypointExecutable, exe, PATH_MAX - 1);
index 994978c..d5bae87 100644 (file)
@@ -96,7 +96,7 @@ inline CHECK CheckOverflow(RVA value1, COUNT_T value2)
 #define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x4644
 #elif defined(__FreeBSD__)
 #define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0xADC4
-#elif defined(__LINUX__)
+#elif defined(__linux__)
 #define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x7B79
 #elif defined(__NetBSD__)
 #define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x1993
index c94393d..a10f228 100644 (file)
@@ -3488,11 +3488,11 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context,
 #define PAL_CS_NATIVE_DATA_SIZE 24
 #elif defined(__hpux__) && (defined(__hppa__) || defined (__ia64__))
 #define PAL_CS_NATIVE_DATA_SIZE 148
-#elif defined(__LINUX__) && defined(_ARM_)
+#elif defined(__linux__) && defined(_ARM_)
 #define PAL_CS_NATIVE_DATA_SIZE 80
-#elif defined(__LINUX__) && defined(_ARM64_)
+#elif defined(__linux__) && defined(_ARM64_)
 #define PAL_CS_NATIVE_DATA_SIZE 116
-#elif defined(__LINUX__) && defined(__x86_64__)
+#elif defined(__linux__) && defined(__x86_64__)
 #define PAL_CS_NATIVE_DATA_SIZE 96
 #elif defined(__NetBSD__) && defined(__amd64__)
 #define PAL_CS_NATIVE_DATA_SIZE 96
index aa72d66..df17767 100644 (file)
@@ -571,7 +571,7 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
 #endif
 
 #ifndef PAL_STDCPP_COMPAT
-#if defined(__APPLE_CC__) || defined(__LINUX__)
+#if defined(__APPLE_CC__) || defined(__linux__)
 #ifdef BIT64
 typedef unsigned long size_t;
 typedef long ptrdiff_t;
@@ -608,7 +608,7 @@ typedef char16_t WCHAR;
 #else // PAL_STDCPP_COMPAT
 
 typedef wchar_t WCHAR;
-#if defined(__LINUX__) 
+#if defined(__linux__) 
 #ifdef BIT64
 typedef long int intptr_t;
 typedef unsigned long int uintptr_t;
index 5cb92bb..2034812 100644 (file)
@@ -47,10 +47,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
   )
 endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
 
-if(CMAKE_SYSTEM_NAME STREQUAL Linux)
-  add_definitions(-D__LINUX__=1)
-endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
-
 add_definitions(-DPLATFORM_UNIX=1)
 add_definitions(-DLP64COMPATIBLE=1)
 add_definitions(-DFEATURE_PAL=1)
index 3335443..ee33f7a 100644 (file)
@@ -29,15 +29,15 @@ Abstract:
 #include <exception>
     
 #if HAVE_LIBUNWIND_H
-#ifndef __LINUX__
+#ifndef __linux__
 #define UNW_LOCAL_ONLY
-#endif // !__LINUX__       
+#endif // !__linux__       
 #include <libunwind.h>
-#ifdef __LINUX__
+#ifdef __linux__
 #ifdef HAVE_LIBUNWIND_PTRACE
 #include <libunwind-ptrace.h>
 #endif // HAVE_LIBUNWIND_PTRACE
-#endif // __LINUX__    
+#endif // __linux__    
 #endif // HAVE_LIBUNWIND_H
 
 
index 3f15c82..8c640a3 100644 (file)
@@ -201,7 +201,7 @@ PAL_ERROR SEHEnable(CPalThread *pthrCurrent)
 {
 #if HAVE_MACH_EXCEPTIONS
     return pthrCurrent->EnableMachExceptions();
-#elif __LINUX__ || defined(__FreeBSD__) || defined(__NetBSD__)
+#elif __linux__ || defined(__FreeBSD__) || defined(__NetBSD__)
     // TODO: This needs to be implemented. Cannot put an ASSERT here
     // because it will make other parts of PAL fail.
     return NO_ERROR;
@@ -230,7 +230,7 @@ PAL_ERROR SEHDisable(CPalThread *pthrCurrent)
     return pthrCurrent->DisableMachExceptions();
     // TODO: This needs to be implemented. Cannot put an ASSERT here
     // because it will make other parts of PAL fail.
-#elif __LINUX__ || defined(__FreeBSD__) || defined(__NetBSD__)
+#elif __linux__ || defined(__FreeBSD__) || defined(__NetBSD__)
     return NO_ERROR;
 #else // HAVE_MACH_EXCEPTIONS
 #error not yet implemented
index abaa025..524c552 100644 (file)
@@ -820,7 +820,7 @@ Abstract:
   linux we need to use gettid(). 
 
 --*/
-#if defined(__LINUX__)
+#if defined(__linux__)
 #define THREADSilentGetCurrentThreadId() (SIZE_T)syscall(SYS_gettid)
 #elif defined(__APPLE__)
 inline SIZE_T THREADSilentGetCurrentThreadId() {
index 10871aa..0855a00 100644 (file)
@@ -670,7 +670,7 @@ BOOL
 PALAPI
 PAL_IsDebuggerPresent()
 {
-#if defined(__LINUX__)
+#if defined(__linux__)
     BOOL debugger_present = FALSE;
     char buf[2048];
 
index 83d45f3..f7febcf 100644 (file)
@@ -54,7 +54,7 @@ Abstract:
 #include <sys/types.h>
 #include <sys/mman.h>
 
-#if defined(__LINUX__)
+#if defined(__linux__)
 #include <gnu/lib-names.h>
 #endif
 
index 2a0d5d8..767ad39 100644 (file)
@@ -171,7 +171,7 @@ GetSystemInfo(
 
 #ifdef VM_MAXUSER_ADDRESS
     lpSystemInfo->lpMaximumApplicationAddress = (PVOID) VM_MAXUSER_ADDRESS;
-#elif defined(__sun__) || defined(_AIX) || defined(__hppa__) || ( defined (_IA64_) && defined (_HPUX_) ) || defined(__LINUX__)
+#elif defined(__sun__) || defined(_AIX) || defined(__hppa__) || ( defined (_IA64_) && defined (_HPUX_) ) || defined(__linux__)
     lpSystemInfo->lpMaximumApplicationAddress = (PVOID) -1;
 #elif defined(USERLIMIT)
     lpSystemInfo->lpMaximumApplicationAddress = (PVOID) USERLIMIT;
@@ -346,7 +346,7 @@ PAL_GetLogicalProcessorCacheSizeFromOS()
 {
     size_t cacheSize = 0;
 
-#if HAVE_SYSCONF && defined(__LINUX__)
+#if HAVE_SYSCONF && defined(__linux__)
     cacheSize = max(cacheSize, sysconf(_SC_LEVEL1_DCACHE_SIZE));
     cacheSize = max(cacheSize, sysconf(_SC_LEVEL1_ICACHE_SIZE));
     cacheSize = max(cacheSize, sysconf(_SC_LEVEL2_CACHE_SIZE));
index 68f898d..4df06e2 100644 (file)
@@ -35,7 +35,7 @@ SET_DEFAULT_DEBUG_CHANNEL(MISC);
 Initialization logic for LTTng tracepoint providers.
 
 --*/
-#if defined(__LINUX__)
+#if defined(__linux__)
 
 static const char tpLibName[] = "libcoreclrtraceptprovider.so";
 
index 5e47bca..a6d1ba4 100644 (file)
@@ -10,7 +10,6 @@ endif()
 
 # Compile options
 add_definitions(-DPLATFORM_UNIX=1)
-add_definitions(-D__LINUX__=1)
 add_definitions(-DLP64COMPATIBLE=1)
 add_definitions(-DFEATURE_PAL=1)
 add_definitions(-DCORECLR=1)