Skip to content

Commit

Permalink
Fix build with clang 10
Browse files Browse the repository at this point in the history
This fixes 3 different sets of build issues seen when compiling with
Clang 10.

- Clang 10 fails to compile slist.h because the code contained is
  actually invalid. The assignment operator being used doesn't exist.

  This is a backport of dotnet/runtime#33096

- Clang 10 has moved exception-handling mismatches in function
  declarations under the -fms-compatibility flag (instead of the
  -fms-extensions flag). Our declarations of atoll and other similar
  functions are missing the exception declaration `throw()`. This
  mismatch in exception declarations makes clang 10 unable to build this
  code. Fix it by defining THROW_DECL as `throw()` which is supported at
  least as far back as clang 3.3.

  This is a backport of dotnet/runtime#32837

- Clang 10 has enabled additional warnings. Lets turn of -Werror
  globally in this release branch by making the `-ignorewarnings` switch
  to `./build.sh` be the default.
  • Loading branch information
omajid committed Mar 16, 2020
1 parent c5d3d75 commit ee39a13
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ esac

__BuildType=Debug
__CodeCoverage=
__IgnoreWarnings=0
__IgnoreWarnings=1

# Set the various build properties here so that CMake and MSBuild can pick them up
__ProjectDir="$__ProjectRoot"
Expand Down Expand Up @@ -648,7 +648,7 @@ __GccMajorVersion=0
__GccMinorVersion=0
__NuGetPath="$__PackagesDir/NuGet.exe"
__DistroRid=""
__cmakeargs=""
__cmakeargs="-DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF"
__SkipGenerateVersion=0
__PortableBuild=1
__msbuildonunsupportedplatform=0
Expand Down
6 changes: 3 additions & 3 deletions src/inc/slist.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ class SList
void Init()
{
LIMITED_METHOD_CONTRACT;
m_pHead = &m_link;
m_pHead = PTR_SLink(&m_link);
// NOTE :: fHead variable is template argument
// the following code is a compiled in, only if the fHead flag
// is set to false,
if (!fHead)
{
m_pTail = &m_link;
m_pTail = PTR_SLink(&m_link);
}
}

Expand Down Expand Up @@ -274,7 +274,7 @@ class SList
SLink *ret = SLink::FindAndRemove(m_pHead, GetLink(pObj), &prior);

if (ret == m_pTail)
m_pTail = prior;
m_pTail = PTR_SLink(prior);

return GetObject(ret);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pal/inc/mbusafecrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef int errno_t;
#define SAFECRT_SUCCESS 0

#ifndef THROW_DECL
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
#if defined(_MSC_VER) || !defined(__cplusplus)
#define THROW_DECL
#else
#define THROW_DECL throw()
Expand Down
2 changes: 1 addition & 1 deletion src/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ typedef PVOID NATIVE_LIBRARY_HANDLE;

/******************* Compiler-specific glue *******************************/
#ifndef THROW_DECL
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
#if defined(_MSC_VER) || !defined(__cplusplus)
#define THROW_DECL
#else
#define THROW_DECL throw()
Expand Down

0 comments on commit ee39a13

Please sign in to comment.