Compile with gcc 4.8 (dotnet/coreclr#27625)
authorSinan Kaya <41809318+franksinankaya@users.noreply.github.com>
Sat, 2 Nov 2019 19:29:22 +0000 (15:29 -0400)
committerJan Kotas <jkotas@microsoft.com>
Sat, 2 Nov 2019 19:29:22 +0000 (12:29 -0700)
* Remove VOID on parameters

* Detect compiler support

* Clarify version

In file included from coreclr/src/vm/dumpdiagnosticprotocolhelper.h:11:0,
                 from coreclr/src/vm/dumpdiagnosticprotocolhelper.cpp:7:
coreclr/src/vm/diagnosticsprotocol.h: In member function ‘bool DiagnosticsIpc::IpcMessage::Initialize(HRESULT)’:
coreclr/src/vm/diagnosticsprotocol.h:239:56: error: call of overloaded ‘Initialize(const DiagnosticsIpc::IpcHeader&, HRESULT&)’ is ambiguous
             return Initialize(GenericErrorHeader, error);
                                                        ^
coreclr/src/vm/diagnosticsprotocol.h:239:56: note: candidates are:
coreclr/src/vm/diagnosticsprotocol.h:196:14: note: bool DiagnosticsIpc::IpcMessage::Initialize(DiagnosticsIpc::IpcHeader, T&) [with T = int]
         bool Initialize(IpcHeader header, T& payload)
              ^
coreclr/src/vm/diagnosticsprotocol.h:213:14: note: bool DiagnosticsIpc::IpcMessage::Initialize(DiagnosticsIpc::IpcHeader, T&&) [with T = int&]
         bool Initialize(IpcHeader header, T&& payload)
              ^

Commit migrated from https://github.com/dotnet/coreclr/commit/1b53ff1e38f774bb50666ffc5a2595996f90e8dd

src/coreclr/configurecompiler.cmake
src/coreclr/src/pal/inc/pal.h
src/coreclr/src/pal/inc/palprivate.h
src/coreclr/src/vm/diagnosticsprotocol.h
src/coreclr/src/vm/dumpdiagnosticprotocolhelper.cpp

index 81620bde186b8397591f7a6105fb11db7b189b09..9f6505e468b37f8d4472e5829fc432fa47def728 100644 (file)
@@ -19,8 +19,6 @@ if(NOT MSVC AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
 endif()
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
-check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW)
-
 #----------------------------------------
 # Detect and set platform variable names
 #     - for non-windows build platform & architecture is detected using inbuilt CMAKE variables and cross target component configure
@@ -466,7 +464,10 @@ if (CLR_CMAKE_PLATFORM_UNIX)
     # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
     add_compile_options(-fstack-protector)
   else()
-    add_compile_options(-fstack-protector-strong)
+    check_cxx_compiler_flag(-fstack-protector-strong COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
+    if (COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
+      add_compile_options(-fstack-protector-strong)
+    endif()
   endif(CLR_CMAKE_PLATFORM_DARWIN)
 
   # Contracts are disabled on UNIX.
@@ -513,6 +514,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
   else()
     add_compile_options(-Wno-unused-but-set-variable)
     add_compile_options(-Wno-unknown-pragmas)
+    check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW)
     if (COMPILER_SUPPORTS_F_ALIGNED_NEW)
       add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-faligned-new>)
     endif()
index 01eb3f7489a795fcbb88b05e704ef478e339d8ff..0e1312dbe5a02954a92bac43482e72d87fdea394 100644 (file)
@@ -276,7 +276,7 @@ typedef char * va_list;
 PALIMPORT
 BOOL
 PALAPI
-PAL_IsDebuggerPresent(VOID);
+PAL_IsDebuggerPresent();
 
 /* minimum signed 64 bit value */
 #define _I64_MIN    (I64(-9223372036854775807) - 1)
@@ -370,8 +370,7 @@ PAL_InitializeWithFlags(
 PALIMPORT
 int
 PALAPI
-PAL_InitializeDLL(
-    VOID);
+PAL_InitializeDLL();
 
 PALIMPORT
 void
@@ -453,7 +452,7 @@ PAL_UnregisterForRuntimeStartup(
 PALIMPORT
 BOOL
 PALAPI
-PAL_NotifyRuntimeStarted(VOID);
+PAL_NotifyRuntimeStarted();
 
 #ifdef __APPLE__
 PALIMPORT
@@ -1067,8 +1066,7 @@ FlushFileBuffers(
 PALIMPORT
 UINT
 PALAPI
-GetConsoleOutputCP(
-           VOID);
+GetConsoleOutputCP();
 
 PALIMPORT
 DWORD
@@ -1318,40 +1316,34 @@ ReleaseMutex(
 PALIMPORT
 DWORD
 PALAPI
-GetCurrentProcessId(
-            VOID);
+GetCurrentProcessId();
 
 PALIMPORT
 DWORD
 PALAPI
-GetCurrentSessionId(
-            VOID);
+GetCurrentSessionId();
 
 PALIMPORT
 HANDLE
 PALAPI
-GetCurrentProcess(
-          VOID);
+GetCurrentProcess();
 
 PALIMPORT
 DWORD
 PALAPI
-GetCurrentThreadId(
-           VOID);
+GetCurrentThreadId();
 
 PALIMPORT
 size_t
 PALAPI
-PAL_GetCurrentOSThreadId(
-           VOID);
+PAL_GetCurrentOSThreadId();
 
 // To work around multiply-defined symbols in the Carbon framework.
 #define GetCurrentThread PAL_GetCurrentThread
 PALIMPORT
 HANDLE
 PALAPI
-GetCurrentThread(
-         VOID);
+GetCurrentThread();
 
 
 #define STARTF_USESTDHANDLES       0x00000100
@@ -1559,8 +1551,7 @@ SleepEx(
 PALIMPORT
 BOOL
 PALAPI
-SwitchToThread(
-    VOID);
+SwitchToThread();
 
 #define DEBUG_PROCESS                     0x00000001
 #define DEBUG_ONLY_THIS_PROCESS           0x00000002
@@ -2414,27 +2405,27 @@ GetThreadTimes(
 PALIMPORT
 PVOID
 PALAPI
-PAL_GetStackBase(VOID);
+PAL_GetStackBase();
 
 PALIMPORT
 PVOID
 PALAPI
-PAL_GetStackLimit(VOID);
+PAL_GetStackLimit();
 
 PALIMPORT
 DWORD
 PALAPI
-PAL_GetLogicalCpuCountFromOS(VOID);
+PAL_GetLogicalCpuCountFromOS();
 
 PALIMPORT
 DWORD
 PALAPI
-PAL_GetTotalCpuCount(VOID);
+PAL_GetTotalCpuCount();
 
 PALIMPORT
 size_t
 PALAPI
-PAL_GetRestrictedPhysicalMemoryLimit(VOID);
+PAL_GetRestrictedPhysicalMemoryLimit();
 
 PALIMPORT
 BOOL
@@ -2449,7 +2440,7 @@ PAL_GetCpuLimit(UINT* val);
 PALIMPORT
 size_t
 PALAPI
-PAL_GetLogicalProcessorCacheSizeFromOS(VOID);
+PAL_GetLogicalProcessorCacheSizeFromOS();
 
 typedef BOOL(*UnwindReadMemoryCallback)(PVOID address, PVOID buffer, SIZE_T size);
 
@@ -2852,8 +2843,7 @@ VirtualQuery(
 PALIMPORT
 HANDLE
 PALAPI
-GetProcessHeap(
-           VOID);
+GetProcessHeap();
 
 #define HEAP_ZERO_MEMORY 0x00000008
 
@@ -3145,8 +3135,7 @@ OutputDebugStringW(
 PALIMPORT
 VOID
 PALAPI
-DebugBreak(
-       VOID);
+DebugBreak();
 
 PALIMPORT
 DWORD
@@ -3178,8 +3167,7 @@ SetEnvironmentVariableW(
 PALIMPORT
 LPWSTR
 PALAPI
-GetEnvironmentStringsW(
-               VOID);
+GetEnvironmentStringsW();
 
 #ifdef UNICODE
 #define GetEnvironmentStrings GetEnvironmentStringsW
@@ -3225,13 +3213,12 @@ RaiseFailFastException(
 PALIMPORT
 DWORD
 PALAPI
-GetTickCount(
-         VOID);
+GetTickCount();
 
 PALIMPORT
 ULONGLONG
 PALAPI
-GetTickCount64(VOID);
+GetTickCount64();
 
 PALIMPORT
 BOOL
@@ -3703,8 +3690,7 @@ PALIMPORT
 inline
 VOID
 PALAPI
-MemoryBarrier(
-    VOID)
+MemoryBarrier()
 {
     __sync_synchronize();
 }
@@ -3714,8 +3700,7 @@ PALIMPORT
 inline
 VOID
 PALAPI
-YieldProcessor(
-    VOID)
+YieldProcessor()
 {
 #if defined(_X86_) || defined(_AMD64_)
     __asm__ __volatile__(
@@ -3731,7 +3716,7 @@ YieldProcessor(
 PALIMPORT
 DWORD
 PALAPI
-GetCurrentProcessorNumber(VOID);
+GetCurrentProcessorNumber();
 
 /*++
 Function:
@@ -3743,7 +3728,7 @@ Checks if GetCurrentProcessorNumber is available in the current environment
 PALIMPORT
 BOOL
 PALAPI
-PAL_HasGetCurrentProcessorNumber(VOID);
+PAL_HasGetCurrentProcessorNumber();
 
 #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
 #define FORMAT_MESSAGE_IGNORE_INSERTS  0x00000200
@@ -3772,8 +3757,7 @@ FormatMessageW(
 PALIMPORT
 DWORD
 PALAPI
-GetLastError(
-         VOID);
+GetLastError();
 
 PALIMPORT
 VOID
@@ -3784,8 +3768,7 @@ SetLastError(
 PALIMPORT
 LPWSTR
 PALAPI
-GetCommandLineW(
-        VOID);
+GetCommandLineW();
 
 #ifdef UNICODE
 #define GetCommandLine GetCommandLineW
@@ -3829,7 +3812,7 @@ ResetWriteWatch(
 PALIMPORT
 VOID
 PALAPI
-FlushProcessWriteBuffers(VOID);
+FlushProcessWriteBuffers();
 
 typedef void (*PAL_ActivationFunction)(CONTEXT *context);
 typedef BOOL (*PAL_SafeActivationCheckFunction)(SIZE_T ip, BOOL checkingCurrentThread);
@@ -4553,22 +4536,22 @@ PAL_GetCPUBusyTime(
 PALIMPORT
 VOID
 PALAPI
-PAL_EnableProcessProfile(VOID);
+PAL_EnableProcessProfile();
 
 PALIMPORT
 VOID
 PALAPI
-PAL_DisableProcessProfile(VOID);
+PAL_DisableProcessProfile();
 
 PALIMPORT
 BOOL
 PALAPI
-PAL_IsProcessProfileEnabled(VOID);
+PAL_IsProcessProfileEnabled();
 
 PALIMPORT
 INT64
 PALAPI
-PAL_GetCpuTickCount(VOID);
+PAL_GetCpuTickCount();
 #endif // PAL_PERF
 
 /******************* PAL functions for SIMD extensions *****************/
index b9c9d08a2f83f875f70e5248a3f640f52f07bf9f..a4b41fa7d337bd8a8a74ea118d2e1b2d0a84237e 100644 (file)
@@ -243,8 +243,7 @@ GetModuleFileNameA(
 PALIMPORT
 LPSTR
 PALAPI
-GetEnvironmentStringsA(
-               VOID);
+GetEnvironmentStringsA();
 
 PALIMPORT
 BOOL
index c0ed44e926a8f5c29a98377534b464b3e9a9e72e..823fc5e3394a84e14906dd7b70a088100a8f750d 100644 (file)
@@ -208,23 +208,6 @@ namespace DiagnosticsIpc
             return FlattenImpl<T>(payload);
         };
 
-        // Initialize an outgoing IpcMessage with a header and payload
-        template <typename T>
-        bool Initialize(IpcHeader header, T&& payload)
-        {
-            CONTRACTL
-            {
-                NOTHROW;
-                GC_TRIGGERS;
-                MODE_PREEMPTIVE;
-            }
-            CONTRACTL_END;
-
-            m_Header = header;
-
-            return FlattenImpl<T>(payload);
-        };
-
         // Initialize an outgoing IpcMessage for an error
         bool Initialize(HRESULT error)
         {
index 48577c54dd95e1b64a11479fe45658651a9b79da..032b94f825d0c60fe1e17d588ed76ba31d5c68f6 100644 (file)
@@ -109,7 +109,8 @@ void DumpDiagnosticProtocolHelper::GenerateCoreDump(DiagnosticsIpc::IpcMessage&
     }
 
     DiagnosticsIpc::IpcMessage successResponse;
-    if (successResponse.Initialize(DiagnosticsIpc::GenericSuccessHeader, S_OK))
+    HRESULT success = S_OK;
+    if (successResponse.Initialize(DiagnosticsIpc::GenericSuccessHeader, success))
         successResponse.Send(pStream);
     delete pStream;
 }