Skip to content

Commit fcbfb3d

Browse files
Fix dev12 build
The dev12 toolset was unhappy with the redeclaration of class static constants, that was done to satisfy clang. Dev12 treats the second declaration as a second definition and makes the linker unhappy. Conditionally compiled out the redeclarations on dev12.
1 parent 658d947 commit fcbfb3d

14 files changed

Lines changed: 71 additions & 1 deletion

lib/Common/Common/NumberUtilities.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
namespace Js
1111
{
12+
// The VS2013 linker treats this as a redefinition of an already
13+
// defined constant and complains. So skip the declaration if we're compiling
14+
// with VS2013 or below.
15+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
1216
// Redeclare static constants
1317
const UINT64 NumberConstantsBase::k_Nan;
1418
const INT64 NumberUtilitiesBase::Pos_InvalidInt64;
@@ -31,6 +35,7 @@ namespace Js
3135
const uint32 NumberConstants::k_Float32NegZero;
3236
const uint32 NumberConstants::k_Float32TwoToFraction;
3337
const uint32 NumberConstants::k_Float32NegTwoToFraction;
38+
#endif
3439

3540
const double NumberConstants::MAX_VALUE = *(double*)(&NumberConstants::k_PosMax);
3641
const double NumberConstants::MIN_VALUE = *(double*)(&NumberConstants::k_PosMin);

lib/Common/Memory/ArenaAllocator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
#define ASSERT_THREAD() AssertMsg(this->pageAllocator->ValidThreadAccess(), "Arena allocation should only be used by a single thread")
88

9+
// The VS2013 linker treats this as a redefinition of an already
10+
// defined constant and complains. So skip the declaration if we're compiling
11+
// with VS2013 or below.
12+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
913
const uint Memory::StandAloneFreeListPolicy::MaxEntriesGrowth;
14+
#endif
1015

1116
#ifdef _MSC_VER
1217
template __forceinline BVSparseNode * BVSparse<JitArenaAllocator>::NodeFromIndex(BVIndex i, BVSparseNode *** prevNextFieldOut, bool create);

lib/Common/Memory/HeapBlockMap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
//-------------------------------------------------------------------------------------------------------
55
#include "CommonMemoryPch.h"
66

7+
// The VS2013 linker treats this as a redefinition of an already
8+
// defined constant and complains. So skip the declaration if we're compiling
9+
// with VS2013 or below.
10+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
711
const uint Memory::HeapBlockMap32::L1Count;
812
const uint Memory::HeapBlockMap32::L2Count;
13+
#endif
914

1015
#if defined(_M_X64_OR_ARM64)
1116
HeapBlockMap32::HeapBlockMap32(__in char * startAddress) :

lib/Common/Memory/HeapInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ template __forceinline char* HeapInfo::RealAlloc<NoBit, false>(Recycler * recycl
1818
template __attribute__((always_inline)) char* HeapInfo::RealAlloc<NoBit, false>(Recycler * recycler, size_t sizeCat, size_t size);
1919
#endif
2020

21+
// The VS2013 linker treats this as a redefinition of an already
22+
// defined constant and complains. So skip the declaration if we're compiling
23+
// with VS2013 or below.
24+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
2125
const uint SmallAllocationBlockAttributes::MaxSmallObjectCount;
2226
const uint MediumAllocationBlockAttributes::MaxSmallObjectCount;
27+
#endif
2328

2429
HeapInfo::ValidPointersMap<SmallAllocationBlockAttributes> HeapInfo::smallAllocValidPointersMap;
2530
HeapInfo::ValidPointersMap<MediumAllocationBlockAttributes> HeapInfo::mediumAllocValidPointersMap;

lib/Parser/CharSet.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,11 +1870,16 @@ namespace UnifiedRegex
18701870
}
18711871
#endif
18721872

1873-
const int CharSetNode::directBits;
1873+
// The VS2013 linker treats this as a redefinition of an already
1874+
// defined constant and complains. So skip the declaration if we're compiling
1875+
// with VS2013 or below.
1876+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
1877+
const int CharSetNode::directBits;
18741878
const uint CharSetNode::directSize;
18751879
const uint CharSetNode::innerMask;
18761880
const int CharSetNode::bitsPerLeafLevel;
18771881
const int CharSetNode::branchingPerLeafLevel;
18781882
const uint CharSetNode::leafMask;
18791883
const uint CharSetNode::levels;
1884+
#endif
18801885
}

lib/Parser/CharTrie.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
namespace UnifiedRegex
88
{
9+
// The VS2013 linker treats this as a redefinition of an already
10+
// defined constant and complains. So skip the declaration if we're compiling
11+
// with VS2013 or below.
12+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
913
const int CharTrie::initCapacity;
14+
#endif
1015

1116
// ----------------------------------------------------------------------
1217
// CharTrie

lib/Parser/RegexCompileTime.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ namespace UnifiedRegex
1111
// Compiler (inlines etc)
1212
// ----------------------------------------------------------------------
1313

14+
// The VS2013 linker treats this as a redefinition of an already
15+
// defined constant and complains. So skip the declaration if we're compiling
16+
// with VS2013 or below.
17+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
1418
const CharCount Compiler::initInstBufSize;
19+
#endif
1520

1621
uint8* Compiler::Emit(size_t size)
1722
{

lib/Runtime/Base/Constants.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66

77
using namespace Js;
88

9+
// The VS2013 linker treats this as a redefinition of an already
10+
// defined constant and complains. So skip the declaration if we're compiling
11+
// with VS2013 or below.
12+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
913
const uint Constants::InvalidSourceIndex;
1014
const RegSlot Constants::NoRegister;
15+
#endif
1116

1217
const char16 Constants::AnonymousFunction[] = _u("Anonymous function");
1318
const char16 Constants::Anonymous[] = _u("anonymous");

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333

3434
namespace Js
3535
{
36+
// The VS2013 linker treats this as a redefinition of an already
37+
// defined constant and complains. So skip the declaration if we're compiling
38+
// with VS2013 or below.
39+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
3640
uint const ScopeSlots::MaxEncodedSlotCount;
41+
#endif
3742

3843
CriticalSection FunctionProxy::GlobalLock;
3944

lib/Runtime/Library/ConcatString.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ namespace Js
120120
/////////////////////// ConcatStringBuilder //////////////////////////
121121

122122
// MAX number of slots in one chunk. Until we fit into this, we realloc, otherwise create new chunk.
123+
// The VS2013 linker treats this as a redefinition of an already
124+
// defined constant and complains. So skip the declaration if we're compiling
125+
// with VS2013 or below.
126+
#if !defined(_MSC_VER) || _MSC_VER >= 1900
123127
const int ConcatStringBuilder::c_maxChunkSlotCount;
128+
#endif
124129

125130
ConcatStringBuilder::ConcatStringBuilder(ScriptContext* scriptContext, int initialSlotCount) :
126131
ConcatStringBase(scriptContext->GetLibrary()->GetStringTypeStatic()),

0 commit comments

Comments
 (0)