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

Commit aaa1e0e

Browse files
authored
Fix build with clang 10 (#28026)
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.
1 parent 0791a4a commit aaa1e0e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ esac
612612

613613
__BuildType=Debug
614614
__CodeCoverage=
615-
__IgnoreWarnings=0
615+
__IgnoreWarnings=1
616616

617617
# Set the various build properties here so that CMake and MSBuild can pick them up
618618
__ProjectDir="$__ProjectRoot"
@@ -648,7 +648,7 @@ __GccMajorVersion=0
648648
__GccMinorVersion=0
649649
__NuGetPath="$__PackagesDir/NuGet.exe"
650650
__DistroRid=""
651-
__cmakeargs=""
651+
__cmakeargs="-DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF"
652652
__SkipGenerateVersion=0
653653
__PortableBuild=1
654654
__msbuildonunsupportedplatform=0

src/inc/slist.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ class SList
160160
void Init()
161161
{
162162
LIMITED_METHOD_CONTRACT;
163-
m_pHead = &m_link;
163+
m_pHead = PTR_SLink(&m_link);
164164
// NOTE :: fHead variable is template argument
165165
// the following code is a compiled in, only if the fHead flag
166166
// is set to false,
167167
if (!fHead)
168168
{
169-
m_pTail = &m_link;
169+
m_pTail = PTR_SLink(&m_link);
170170
}
171171
}
172172

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

276276
if (ret == m_pTail)
277-
m_pTail = prior;
277+
m_pTail = PTR_SLink(prior);
278278

279279
return GetObject(ret);
280280
}

src/pal/inc/mbusafecrt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ typedef int errno_t;
3232
#define SAFECRT_SUCCESS 0
3333

3434
#ifndef THROW_DECL
35-
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
35+
#if defined(_MSC_VER) || !defined(__cplusplus)
3636
#define THROW_DECL
3737
#else
3838
#define THROW_DECL throw()

src/pal/inc/pal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef PVOID NATIVE_LIBRARY_HANDLE;
145145

146146
/******************* Compiler-specific glue *******************************/
147147
#ifndef THROW_DECL
148-
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
148+
#if defined(_MSC_VER) || !defined(__cplusplus)
149149
#define THROW_DECL
150150
#else
151151
#define THROW_DECL throw()

0 commit comments

Comments
 (0)