Skip to content

Commit de0391f

Browse files
committed
Fixup for MSVC 2013
1 parent 67e9d0e commit de0391f

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

src/ast.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
#include "fn_utils.hpp"
2424
#include "memory_pool.hpp"
2525
#include "var_stack.hpp"
26+
#include "ordered_map.hpp"
2627

27-
#include "ordered-map/ordered_map.h"
28+
// #include "ordered-map/ordered_map.h"
2829

2930
namespace Sass {
3031

@@ -524,10 +525,9 @@ namespace Sass {
524525
class Hashed {
525526

526527

527-
using ordered_map_type = typename tsl::ordered_map<
528+
using ordered_map_type = typename ordered_map<
528529
K, T, ObjHash, ObjEquality,
529-
SassAllocator<std::pair<K, T>>,
530-
sass::vector<std::pair<K, T>>
530+
SassAllocator<std::pair<K, T>>
531531
>;
532532

533533
protected:
@@ -567,7 +567,7 @@ namespace Sass {
567567
bool empty() const { return elements_.empty(); }
568568

569569
bool has(K k) const {
570-
return elements_.count(k);
570+
return elements_.count(k) == 1;
571571
}
572572

573573
void reserve(size_t size)

src/environment.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
// #include "../../hopscotch-map/include/tsl/hopscotch_map.h"
2828
// #include "../../hopscotch-map/include/tsl/hopscotch_set.h"
29-
#include "ordered-map/ordered_map.h"
29+
// #include "ordered-map/ordered_map.h"
3030
// #include "../../ordered-map/include/tsl/ordered_set.h"
3131
// #include "robin_hood.hpp"
3232

@@ -54,18 +54,17 @@ namespace Sass {
5454
>;
5555

5656
template<class T>
57-
using NormalizedOMap = tsl::ordered_map<
57+
using NormalizedOMap = ordered_map<
5858
EnvString, T,
5959
SassIgnoreDashPair,
6060
SassAllocator<std::pair<EnvString, T>>
6161
>;
6262

6363
template<class T>
64-
using KeywordMapOlder = tsl::ordered_map<
64+
using KeywordMapOlder = ordered_map<
6565
EnvString, T,
6666
SassIgnoreDashPair,
67-
SassAllocator<std::pair<EnvString, T>>,
68-
sass::vector<std::pair<EnvString, T>>
67+
SassAllocator<std::pair<EnvString, T>>
6968
>;
7069

7170
using NormalizeSet = std::unordered_set<

src/extender.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "backtrace.hpp"
1313
#include "ordered_map.hpp"
1414

15-
#include "ordered-map/ordered_map.h"
15+
// #include "ordered-map/ordered_map.h"
1616

1717
namespace Sass {
1818

@@ -49,7 +49,7 @@ namespace Sass {
4949
// SassAllocator<std::pair<SimpleSelectorObj, ExtListSelSet>>
5050
> ExtSelMap;
5151

52-
typedef tsl::ordered_map<
52+
typedef ordered_map<
5353
ComplexSelectorObj,
5454
Extension,
5555
ObjHash,
@@ -117,7 +117,7 @@ namespace Sass {
117117
// This tracks the contexts in which each style rule is defined.
118118
// If a rule is defined at the top level, it doesn't have an entry.
119119
// ##########################################################################
120-
tsl::ordered_map<
120+
ordered_map<
121121
SelectorListObj,
122122
CssMediaRuleObj,
123123
ObjPtrHash,

src/file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cstdio>
1717
#include <vector>
1818
#include <algorithm>
19+
#include <unordered_map>
1920
#include <sys/stat.h>
2021
#include "file.hpp"
2122
#include "context.hpp"
@@ -75,7 +76,7 @@ namespace Sass {
7576
}
7677

7778

78-
static thread_local std::unordered_map<
79+
static /* thread_local */ std::unordered_map<
7980
sass::string, bool> cached;
8081

8182
// test if path exists and is a file

src/memory_pool.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Sass {
1111

1212
// Move this to somewhere else, should be global
13-
constexpr size_t SASS_MEM_ALIGN = sizeof(unsigned int);
13+
#define SASS_MEM_ALIGN sizeof(unsigned int)
1414

1515
inline static size_t align2(size_t n) {
1616
return (n + SASS_MEM_ALIGN - 1) & ~(SASS_MEM_ALIGN - 1);
@@ -54,25 +54,25 @@ namespace Sass {
5454

5555

5656
// The size of the memory pool arenas in bytes.
57-
constexpr static size_t SassAllocatorArenaSize = 1024 * 256;
57+
#define SassAllocatorArenaSize (1024 * 256)
5858

5959
// How many buckets should we have for the freelist
6060
// Determines when allocations go directly to malloc/free
6161
// For maximum size of managed items multiply by alignment
62-
constexpr static size_t SassAllocatorBuckets = 512;
62+
#define SassAllocatorBuckets 512
6363

6464
// The alignment for the memory fragments. Must be a multiple
6565
// of `SASS_MEM_ALIGN` and should not be too big (maybe 1 or 2)
66-
constexpr static size_t SassAllocatorAlignment = SASS_MEM_ALIGN * 2;
66+
#define SassAllocatorAlignment (SASS_MEM_ALIGN * 2)
6767

6868
// The number of bytes we use for our book-keeping before every
6969
// memory fragment. Needed to know to which bucket we belongs on
7070
// deallocations, or if it should go directly to the `free` call.
71-
constexpr size_t SassAllocatorBookSize = sizeof(unsigned int);
71+
#define SassAllocatorBookSize sizeof(unsigned int)
7272

7373
// Bytes reserve for book-keeping on the arenas
7474
// Currently unused and for later optimization
75-
constexpr size_t SassAllocatorArenaHeadSize = 0;
75+
#define SassAllocatorArenaHeadSize 0
7676

7777
class MemoryPool {
7878

src/ordered-map/ordered_hash.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ static T numeric_cast(U value, const char* error_message = "numeric_cast() faile
128128
* to represent a std::size_t on 32 and 64 bits platforms, and must be the same size on both platforms.
129129
*/
130130
using slz_size_type = std::uint64_t;
131-
static_assert(std::numeric_limits<slz_size_type>::max() >= std::numeric_limits<std::size_t>::max(),
132-
"slz_size_type must be >= std::size_t");
131+
// static_assert(std::numeric_limits<slz_size_type>::max() >= std::numeric_limits<std::size_t>::max(),
132+
// "slz_size_type must be >= std::size_t");
133133

134134
template<class T, class Deserializer>
135135
static T deserialize_value(Deserializer& deserializer) {

src/randomize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Sass {
1010

11+
typedef __int32 int32_t;
12+
typedef unsigned __int32 uint32_t;
13+
1114
// ToDo: this seems not thread safe!!
1215

1316
// Just a static wrapped around random device

src/units.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "ordered_map.hpp"
77
#include "error_handling.hpp"
88
#include "environment.hpp" // For the hasher
9-
#include "ordered-map/ordered_map.h"
9+
// #include "ordered-map/ordered_map.h"
1010

1111
namespace Sass {
1212

@@ -289,10 +289,9 @@ namespace Sass {
289289
// we basically construct exponents for each unit
290290
// has the advantage that they will be pre-sorted
291291
// ToDo: use fast map implementation?
292-
tsl::ordered_map<sass::string, int,
292+
ordered_map<sass::string, int,
293293
SassIgnoreDashPair,
294-
SassAllocator<std::pair<sass::string, int>>,
295-
sass::vector<std::pair<sass::string, int>>
294+
SassAllocator<std::pair<sass::string, int>>
296295
> exponents;
297296

298297
// initialize by summing up occurences in unit vectors

0 commit comments

Comments
 (0)