Skip to content

Commit 95880ba

Browse files
committed
Try to enable shared ptr debug for CI
1 parent fcdd667 commit 95880ba

File tree

8 files changed

+52
-22
lines changed

8 files changed

+52
-22
lines changed

.github/workflows/build-and-test.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
env:
4545
ASAN_OPTIONS: ${{ matrix.config.asan }}
4646
AUTOTOOLS: ${{ matrix.config.autotools }}
47-
EXTRA_CFLAGS: ${{ matrix.config.cflags }}
48-
EXTRA_CXXFLAGS: ${{ matrix.config.cflags }}
47+
EXTRA_CFLAGS: ${{ matrix.config.cflags }} -DDEBUG_SHARED_PTR
48+
EXTRA_CXXFLAGS: ${{ matrix.config.cflags }} -DDEBUG_SHARED_PTR
4949
EXTRA_LDFLAGS: ${{ matrix.config.cflags }}
5050
SASS_LIBSASS_PATH: libsass
5151
COVERAGE: no
@@ -178,7 +178,7 @@ jobs:
178178
- name: Clone and checkout sass-spec repository
179179
run: git clone https://github.com/mgreter/sass-spec.git --branch refactor/libsass-4-alpha
180180
- name: Compile libsass ${{ matrix.config.build }} build for ${{ matrix.config.platform }}
181-
run: msbuild /m:4 /p:Configuration=${{ matrix.config.build }} /p:Platform=${{ matrix.config.platform }} sassc\win\sassc.sln
181+
run: msbuild /m:4 /p:Configuration=${{ matrix.config.build }} /p:Platform=${{ matrix.config.platform }} /p:DefineConstants="DEBUG_SHARED_PTR" sassc\win\sassc.sln
182182
- name: Check sassc help call
183183
run: sassc\bin\sassc.exe --term-colors --help
184184
- name: Execute spec test runner
@@ -193,10 +193,17 @@ jobs:
193193
# fail-fast: false
194194
matrix:
195195
config:
196-
- {build: shared, platform: x64}
197-
- {build: static, platform: x64}
198-
- {build: shared, platform: x86}
199-
- {build: static, platform: x86}
196+
- {build: shared, platform: x64, cflags: '-g -fsanitize=address'}
197+
- {build: static, platform: x64, cflags: '-g -fsanitize=address'}
198+
- {build: shared, platform: x86, cflags: '-g -fsanitize=address'}
199+
- {build: static, platform: x86, cflags: '-g -fsanitize=address'}
200+
201+
env:
202+
ASAN_OPTIONS: ${{ matrix.config.asan }}
203+
EXTRA_CFLAGS: ${{ matrix.config.cflags }} -DDEBUG_SHARED_PTR
204+
EXTRA_CXXFLAGS: ${{ matrix.config.cflags }} -DDEBUG_SHARED_PTR
205+
SASS_LIBSASS_PATH: libsass
206+
COVERAGE: no
200207

201208
steps:
202209
- name: Change git config to preserve line-endings

src/ast_nodes.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ namespace Sass {
126126
ModRule(
127127
prev, url,
128128
import)
129-
// sheet_(sheet),
130-
// prev_(prev),
131-
// url_(url),
132-
// module_(nullptr)
133129
{}
134130

135131
//////////////////////////////////////////////////////////////////////

src/cencode.cpp

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

1111
namespace base64 {
1212

13+
/////////////////////////////////////////////////////////////////////////
14+
/////////////////////////////////////////////////////////////////////////
15+
1316
void base64_init_encodestate(base64_encodestate* state_in)
1417
{
1518
state_in->step = step_A;
@@ -106,4 +109,7 @@ namespace base64 {
106109
return (int)(codechar - code_out);
107110
}
108111

112+
/////////////////////////////////////////////////////////////////////////
113+
/////////////////////////////////////////////////////////////////////////
114+
109115
}

src/color_maps.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
namespace Sass
99
{
1010

11-
namespace ColorNames
11+
/////////////////////////////////////////////////////////////////////////
12+
/////////////////////////////////////////////////////////////////////////
13+
14+
namespace ColorNames
1215
{
1316
const char aliceblue[] = "aliceblue";
1417
const char antiquewhite[] = "antiquewhite";
@@ -161,7 +164,10 @@ namespace Sass
161164
const char transparent[] = "transparent";
162165
} // namespace ColorNames
163166

164-
namespace Colors
167+
/////////////////////////////////////////////////////////////////////////
168+
/////////////////////////////////////////////////////////////////////////
169+
170+
namespace Colors
165171
{
166172
const SourceSpan color_table(SourceSpan::internal("[COLOR TABLE]"));
167173
const ColorRgba aliceblue(color_table, 240, 248, 255, 1);
@@ -315,7 +321,10 @@ namespace Sass
315321
const ColorRgba transparent(color_table, 0, 0, 0, 0);
316322
} // namespace Colors
317323

318-
static const auto* const colors_to_names = new std::unordered_map<int, const char*>{
324+
/////////////////////////////////////////////////////////////////////////
325+
/////////////////////////////////////////////////////////////////////////
326+
327+
static const auto* const colors_to_names = new std::unordered_map<int, const char*>{
319328
{240 * 0x10000 + 248 * 0x100 + 255, ColorNames::aliceblue},
320329
{250 * 0x10000 + 235 * 0x100 + 215, ColorNames::antiquewhite},
321330
{0 * 0x10000 + 255 * 0x100 + 255, ColorNames::cyan},
@@ -456,6 +465,9 @@ namespace Sass
456465
{154 * 0x10000 + 205 * 0x100 + 50, ColorNames::yellowgreen},
457466
{102 * 0x10000 + 51 * 0x100 + 153, ColorNames::rebeccapurple}};
458467

468+
/////////////////////////////////////////////////////////////////////////
469+
/////////////////////////////////////////////////////////////////////////
470+
459471
static const auto* const names_to_colors =
460472
new std::unordered_map<sass::string, const ColorRgba*>{
461473
{ColorNames::aliceblue, &Colors::aliceblue},
@@ -608,6 +620,9 @@ namespace Sass
608620
{ColorNames::rebeccapurple, &Colors::rebeccapurple},
609621
{ColorNames::transparent, &Colors::transparent}};
610622

623+
/////////////////////////////////////////////////////////////////////////
624+
/////////////////////////////////////////////////////////////////////////
625+
611626
const ColorRgba* name_to_color(const char* key)
612627
{
613628
return name_to_color(sass::string(key));
@@ -648,9 +663,7 @@ namespace Sass
648663
return nullptr;
649664
}
650665

651-
const char* color_to_name(const double key)
652-
{
653-
return color_to_name((int)key);
654-
}
666+
/////////////////////////////////////////////////////////////////////////
667+
/////////////////////////////////////////////////////////////////////////
655668

656669
} // namespace Sass

src/color_maps.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ namespace Sass {
320320
const ColorRgba* name_to_color(const char*);
321321
const ColorRgba* name_to_color(const sass::string&);
322322
const char* color_to_name(const int);
323-
const char* color_to_name(const double);
324323

325324
}
326325

src/eval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ namespace Sass {
721721
ColorRgbaObj rgba = color->toRGBA();
722722
double numval = rgba->r() * 0x10000
723723
+ rgba->g() * 0x100 + rgba->b();
724-
if (const char* disp = color_to_name(numval)) {
724+
if (const char* disp = color_to_name((int)numval)) {
725725
sass::sstream msg;
726726
msg << "You probably don't mean to use the color value ";
727727
msg << disp << " in interpolation here.\nIt may end up represented ";

src/inspect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ namespace Sass {
799799
// otherwise get the possible resolved color name
800800
else {
801801
double numval = r * 0x10000 + g * 0x100 + b;
802-
if (color_to_name(numval))
803-
res_name = color_to_name(numval);
802+
if (color_to_name((int)numval))
803+
res_name = color_to_name((int)numval);
804804
}
805805

806806
sass::sstream hexlet;

src/memory/allocator.cpp

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

99
namespace Sass {
1010

11+
/////////////////////////////////////////////////////////////////////////
12+
/////////////////////////////////////////////////////////////////////////
13+
1114
// You must only use PODs for thread_local.
1215
// Objects get very unpredictable init order.
1316
static thread_local MemoryPool* pool;
1417
static thread_local size_t allocations;
1518

19+
/////////////////////////////////////////////////////////////////////////
20+
/////////////////////////////////////////////////////////////////////////
21+
1622
// Allocate memory from the memory pool.
1723
// Memory pool is allocated on first call.
1824
void* allocateMem(size_t size)
@@ -43,6 +49,9 @@ namespace Sass {
4349

4450
}
4551

52+
/////////////////////////////////////////////////////////////////////////
53+
/////////////////////////////////////////////////////////////////////////
54+
4655
}
4756

4857
#endif

0 commit comments

Comments
 (0)