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 set of build issues are 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 (or made default?) the `misleading-indentation`
  warning which causes errors when trying to compile code in
  src/tools/metainfo/mdinfo.cpp.

  This is a backport of dotnet/runtime#33406
  • Loading branch information
omajid committed Mar 11, 2020
1 parent c5d3d75 commit 1131ec8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
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
10 changes: 5 additions & 5 deletions src/tools/metainfo/mdinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,11 +1948,11 @@ void MDInfo::DisplayCustomAttributeInfo(mdCustomAttribute inValue, const char *p
VWrite(" :: %S", qSigName.Ptr());

// Keep track of coff overhead.
if (!wcscmp(W("__DecoratedName"), rcName))
{
bCoffSymbol = true;
g_cbCoffNames += cbValue + 6;
}
if (!wcscmp(W("__DecoratedName"), rcName))
{
bCoffSymbol = true;
g_cbCoffNames += cbValue + 6;
}
WriteLine("");

VWriteLine("%s\tLength: %ld", preFix, cbValue);
Expand Down

0 comments on commit 1131ec8

Please sign in to comment.