Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fix build with Clang 6.0 and enable build with Clang 5.0 (#16855)
Browse files Browse the repository at this point in the history
* Fix build with Clang 6.0

* Add support for clang 5.0 too
  • Loading branch information
janvorli committed Mar 10, 2018
1 parent c3aef92 commit 57b215f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
10 changes: 10 additions & 0 deletions build.sh
Expand Up @@ -725,6 +725,16 @@ while :; do
__ClangMinorVersion=0
;;

clang5.0|-clang5.0)
__ClangMajorVersion=5
__ClangMinorVersion=0
;;

clang6.0|-clang6.0)
__ClangMajorVersion=6
__ClangMinorVersion=0
;;

ninja|-ninja)
__UseNinja=1
;;
Expand Down
4 changes: 4 additions & 0 deletions compileoptions.cmake
Expand Up @@ -38,6 +38,10 @@ if (CLR_CMAKE_PLATFORM_UNIX)
# There are constants of type BOOL used in a condition. But BOOL is defined as int
# and so the compiler thinks that there is a mistake.
add_compile_options(-Wno-constant-logical-operand)
# We use pshpack1/2/4/8.h and poppack.h headers to set and restore packing. However
# clang 6.0 complains when the packing change lifetime is not contained within
# a header file.
add_compile_options(-Wno-pragma-pack)

add_compile_options(-Wno-unknown-warning-option)

Expand Down
8 changes: 5 additions & 3 deletions src/ToolBox/SOS/lldbplugin/CMakeLists.txt
Expand Up @@ -55,15 +55,15 @@ endif()

if (CLR_CMAKE_PLATFORM_DARWIN)
# Check for LLDB library
find_library(LLDB NAMES LLDB lldb lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
find_library(LLDB NAMES LLDB lldb lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
find_library(LLDB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
find_library(LLDB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
if(LLDB STREQUAL LLDB-NOTFOUND)
if(REQUIRE_LLDBPLUGIN)
set(MESSAGE_MODE FATAL_ERROR)
else()
set(MESSAGE_MODE WARNING)
endif()
message(${MESSAGE_MODE} "Cannot find lldb-3.5, lldb-3.6, lldb-3.8, lldb-3.9 or lldb-4.0. Try installing liblldb-3.9-dev (or the appropriate package for your platform). You may need to set LLVM_HOME if the build still can't find it.")
message(${MESSAGE_MODE} "Cannot find lldb-3.5, lldb-3.6, lldb-3.8, lldb-3.9, lldb-4.0, lldb-5.0 or lldb-6.0. Try installing liblldb-3.9-dev (or the appropriate package for your platform). You may need to set LLVM_HOME if the build still can't find it.")

return()
endif()
Expand All @@ -76,6 +76,8 @@ endif()
# If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared.
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}" NO_DEFAULT_PATH)
find_path(LLDB_H "lldb/API/LLDB.h")
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-6.0/include")
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-5.0/include")
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-4.0/include")
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.9/include")
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.8/include")
Expand Down
2 changes: 1 addition & 1 deletion src/inc/utilcode.h
Expand Up @@ -1106,7 +1106,7 @@ inline HRESULT DecimalCanonicalize(DECIMAL* dec)
//
//*****************************************************************************
// secure version! Specify the size of the each buffer in count of elements
void SplitPath(register const WCHAR *path,
void SplitPath(const WCHAR *path,
__inout_z __inout_ecount_opt(driveSizeInWords) WCHAR *drive, int driveSizeInWords,
__inout_z __inout_ecount_opt(dirSizeInWords) WCHAR *dir, int dirSizeInWords,
__inout_z __inout_ecount_opt(fnameSizeInWords) WCHAR *fname, size_t fnameSizeInWords,
Expand Down
2 changes: 1 addition & 1 deletion src/jit/ee_il_dll.cpp
Expand Up @@ -798,7 +798,7 @@ void Compiler::eeDispVar(ICorDebugInfo::NativeVarInfo* var)
printf("%3d(%10s) : From %08Xh to %08Xh, in ", var->varNumber,
(VarNameToStr(name) == nullptr) ? "UNKNOWN" : VarNameToStr(name), var->startOffset, var->endOffset);

switch (var->loc.vlType)
switch ((Compiler::siVarLocType)var->loc.vlType)
{
case VLT_REG:
case VLT_REG_BYREF:
Expand Down
4 changes: 2 additions & 2 deletions src/vm/gcenv.ee.cpp
Expand Up @@ -15,8 +15,8 @@ void GCToEEInterface::SuspendEE(SUSPEND_REASON reason)
{
WRAPPER_NO_CONTRACT;

static_assert_no_msg(SUSPEND_FOR_GC == ThreadSuspend::SUSPEND_FOR_GC);
static_assert_no_msg(SUSPEND_FOR_GC_PREP == ThreadSuspend::SUSPEND_FOR_GC_PREP);
static_assert_no_msg(SUSPEND_FOR_GC == (int)ThreadSuspend::SUSPEND_FOR_GC);
static_assert_no_msg(SUSPEND_FOR_GC_PREP == (int)ThreadSuspend::SUSPEND_FOR_GC_PREP);

_ASSERTE(reason == SUSPEND_FOR_GC || reason == SUSPEND_FOR_GC_PREP);

Expand Down

0 comments on commit 57b215f

Please sign in to comment.