From 0120aed594bd638136c88bb112383d1b7c201258 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Fri, 9 Feb 2018 16:31:01 +0100 Subject: [PATCH 1/8] Fix Issue 18409 - DScanner SEGFAULTS on CircleCI --- src/analysis/incorrect_infinite_range.d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/analysis/incorrect_infinite_range.d b/src/analysis/incorrect_infinite_range.d index cb3b4c8..6f41b3c 100644 --- a/src/analysis/incorrect_infinite_range.d +++ b/src/analysis/incorrect_infinite_range.d @@ -45,7 +45,8 @@ class IncorrectInfiniteRangeCheck : BaseAnalyzer if (fb.bodyStatement !is null) visit(fb.bodyStatement.blockStatement); else - visit(fb.blockStatement); + if (fb.blockStatement !is null) + visit(fb.blockStatement); } override void visit(const BlockStatement bs) @@ -109,6 +110,12 @@ unittest { return false; } + + // https://issues.dlang.org/show_bug.cgi?id=18409 + struct Foo + { + ~this() nothrow @nogc; + } } bool empty() { return false; } @@ -116,5 +123,6 @@ class C { bool empty() { return false; } } // [warn]: %1$s }c .format(IncorrectInfiniteRangeCheck.MESSAGE), sac); + stderr.writeln("Unittest for IncorrectInfiniteRangeCheck passed."); } From efb0582d2c01fbb08c54402af1906344d1f5e0f7 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 11 Feb 2018 15:06:48 +0100 Subject: [PATCH 2/8] Switch to use the frozen stdx-allocator --- .gitmodules | 3 +++ dub.json | 5 +++-- makefile | 14 +++++++++----- src/analysis/helpers.d | 4 ++-- src/analysis/run.d | 8 ++++---- stdx-allocator | 1 + 6 files changed, 22 insertions(+), 13 deletions(-) create mode 160000 stdx-allocator diff --git a/.gitmodules b/.gitmodules index 921283e..cd5bd3a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ [submodule "libddoc"] path = libddoc url = https://github.com/economicmodeling/libddoc +[submodule "stdx-allocator"] + path = stdx-allocator + url = https://github.com/dlang-community/stdx-allocator diff --git a/dub.json b/dub.json index d47d769..6e9a8ee 100644 --- a/dub.json +++ b/dub.json @@ -13,10 +13,11 @@ ], "dependencies" : { "libdparse" : "~>0.8.0-alpha.2", - "dsymbol" : "~>0.3.0-alpha.1", + "dsymbol" : "~>0.3.0-alpha.2", "inifiled" : ">=1.0.2", "emsi_containers" : "~>0.6.0", - "libddoc" : "~>0.3.0-beta.1" + "libddoc" : "~>0.3.0-beta.1", + "stdx-allocator" : "~>2.77.0" }, "targetPath" : "bin" } diff --git a/makefile b/makefile index 2780216..8fe0445 100644 --- a/makefile +++ b/makefile @@ -11,14 +11,18 @@ LIB_SRC := \ $(shell find inifiled/source/ -name "*.d")\ $(shell find libdparse/src/std/experimental/ -name "*.d")\ $(shell find libdparse/src/dparse/ -name "*.d")\ - $(shell find libddoc/src -name "*.d") + $(shell find libddoc/src -name "*.d") \ + $(shell find stdx-allocator/source -name "*.d") PROJECT_SRC := $(shell find src/ -name "*.d") SRC := $(LIB_SRC) $(PROJECT_SRC) INCLUDE_PATHS = \ - -Iinifiled/source -Isrc\ - -Ilibdparse/src\ - -Idsymbol/src -Icontainers/src\ - -Ilibddoc/src + -Isrc \ + -Iinifiled/source \ + -Ilibdparse/src \ + -Idsymbol/src \ + -Icontainers/src \ + -Ilibddoc/src \ + -Istdx-allocator/source VERSIONS = DEBUG_VERSIONS = -version=dparse_verbose DMD_FLAGS = -w -inline -release -O -J. -od${OBJ_DIR} -version=StdLoggerDisableWarning diff --git a/src/analysis/helpers.d b/src/analysis/helpers.d index 390c7b2..949a4e4 100644 --- a/src/analysis/helpers.d +++ b/src/analysis/helpers.d @@ -16,8 +16,8 @@ import dsymbol.modulecache : ModuleCache; import analysis.config; import analysis.run; import analysis.base; -import std.experimental.allocator.mallocator; -import std.experimental.allocator; +import stdx.allocator.mallocator; +import stdx.allocator; S between(S)(S value, S before, S after) if (isSomeString!S) { diff --git a/src/analysis/run.d b/src/analysis/run.d index 3079e17..b3f13d6 100644 --- a/src/analysis/run.d +++ b/src/analysis/run.d @@ -18,10 +18,10 @@ import dparse.ast; import dparse.rollback_allocator; import std.typecons : scoped; -import std.experimental.allocator : CAllocatorImpl; -import std.experimental.allocator.mallocator : Mallocator; -import std.experimental.allocator.building_blocks.region : Region; -import std.experimental.allocator.building_blocks.allocator_list : AllocatorList; +import stdx.allocator : CAllocatorImpl; +import stdx.allocator.mallocator : Mallocator; +import stdx.allocator.building_blocks.region : Region; +import stdx.allocator.building_blocks.allocator_list : AllocatorList; import analysis.config; import analysis.base; diff --git a/stdx-allocator b/stdx-allocator new file mode 160000 index 0000000..7487970 --- /dev/null +++ b/stdx-allocator @@ -0,0 +1 @@ +Subproject commit 7487970b58f4a2c0d495679329a8a2857111f3fd From 82d56994485ad093d922dae8c26cf01066e6d9d1 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 11 Feb 2018 15:07:12 +0100 Subject: [PATCH 3/8] Bump submodules --- containers | 2 +- dsymbol | 2 +- libddoc | 2 +- libdparse | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/containers b/containers index f58dd7b..6c5504c 160000 --- a/containers +++ b/containers @@ -1 +1 @@ -Subproject commit f58dd7bf160f76762a79029a6bda7637d5a788e7 +Subproject commit 6c5504cc80b75192b24cebe93209521c03f806d8 diff --git a/dsymbol b/dsymbol index 89f6ee8..0c6e748 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit 89f6ee88bf8d0fc0df232cba56bf797f5b3b0487 +Subproject commit 0c6e748baacaeff06ce0fad4838c99505ec85376 diff --git a/libddoc b/libddoc index 73f2761..476c096 160000 --- a/libddoc +++ b/libddoc @@ -1 +1 @@ -Subproject commit 73f2761d859b0364b0b5f77e6316b87ef7052d4f +Subproject commit 476c0964ee173d7574155aa2a9caa2bc019a3754 diff --git a/libdparse b/libdparse index 687c0ca..68b71f9 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 687c0ca751747ebe498c183da1a3ee3119d57932 +Subproject commit 68b71f9c04940993f68bce2511244d55a3a8a648 From f81b01bbfd161c6ead78fc13f1bba06bd5f6af47 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 11 Feb 2018 16:03:56 +0100 Subject: [PATCH 4/8] Bump depenencies --- dsymbol | 2 +- dub.json | 4 ++-- libdparse | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dsymbol b/dsymbol index 0c6e748..5b90412 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit 0c6e748baacaeff06ce0fad4838c99505ec85376 +Subproject commit 5b90412457ac5f1d67c04e4da01587edfd529ad5 diff --git a/dub.json b/dub.json index 6e9a8ee..cda7dc8 100644 --- a/dub.json +++ b/dub.json @@ -12,8 +12,8 @@ "StdLoggerDisableWarning" ], "dependencies" : { - "libdparse" : "~>0.8.0-alpha.2", - "dsymbol" : "~>0.3.0-alpha.2", + "libdparse" : "~>0.8.0-alpha.4", + "dsymbol" : "~>0.3.0-alpha.3", "inifiled" : ">=1.0.2", "emsi_containers" : "~>0.6.0", "libddoc" : "~>0.3.0-beta.1", diff --git a/libdparse b/libdparse index 68b71f9..f3323ce 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 68b71f9c04940993f68bce2511244d55a3a8a648 +Subproject commit f3323ce90a41c24cf874fd257ccbf6cc0b1be285 From 4753c776d4ef438d103bbf14f950c9588e56958c Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 11 Feb 2018 16:34:43 +0100 Subject: [PATCH 5/8] Try to fix the missing dependencies in build.bat --- build.bat | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.bat b/build.bat index 4d35502..a3a0dbb 100644 --- a/build.bat +++ b/build.bat @@ -14,6 +14,7 @@ set INIFILED= set DSYMBOL= set CONTAINERS= set LIBDDOC= +set STDXALLOCATOR= for %%x in (src\*.d) do set CORE=!CORE! %%x for %%x in (src\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x @@ -26,18 +27,20 @@ for %%x in (dsymbol\src\dsymbol\builtin\*.d) do set DSYMBOL=!DSYMBOL! %%x for %%x in (dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x +for %%x in (stdx-allocator\source\stdx\allocator\*.d) do set STDXALLOCATOR=!STDXALLOCATOR! %%x +for %%x in (stdx-allocator\source\stdx\allocator\building_blocks\*.d) do set STDXALLOCATOR=!STDXALLOCATOR! %%x if "%1" == "test" goto test_cmd @echo on -%DC% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -ofbin\dscanner.exe +%DC% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %STDXALLOCATOR% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -ofbin\dscanner.exe goto eof :test_cmd @echo on set TESTNAME="bin\dscanner-unittest" -%DC% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -lib %TESTFLAGS% -of%TESTNAME%.lib -if exist %TESTNAME%.lib %DC% %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -unittest %TESTFLAGS% -of%TESTNAME%.exe +%DC% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -lib %TESTFLAGS% -of%TESTNAME%.lib +if exist %TESTNAME%.lib %DC% %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -unittest %TESTFLAGS% -of%TESTNAME%.exe if exist %TESTNAME%.exe %TESTNAME%.exe if exist %TESTNAME%.obj del %TESTNAME%.obj From 21962db53095cdbe9de1b816f48d5ccbb5de0928 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 11 Feb 2018 20:16:33 +0100 Subject: [PATCH 6/8] fix window bat file --- build.bat | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.bat b/build.bat index a3a0dbb..12d11b6 100644 --- a/build.bat +++ b/build.bat @@ -15,6 +15,7 @@ set DSYMBOL= set CONTAINERS= set LIBDDOC= set STDXALLOCATOR= +set STDXALLOCATORBLOCKS= for %%x in (src\*.d) do set CORE=!CORE! %%x for %%x in (src\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x @@ -28,18 +29,18 @@ for %%x in (dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x for %%x in (stdx-allocator\source\stdx\allocator\*.d) do set STDXALLOCATOR=!STDXALLOCATOR! %%x -for %%x in (stdx-allocator\source\stdx\allocator\building_blocks\*.d) do set STDXALLOCATOR=!STDXALLOCATOR! %%x +for %%x in (stdx-allocator\source\stdx\allocator\building_blocks\*.d) do set STDXALLOCATORBLOCKS=!STDXALLOCATORBLOCKS! %%x if "%1" == "test" goto test_cmd @echo on -%DC% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %STDXALLOCATOR% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -ofbin\dscanner.exe +%DC% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %STDXALLOCATOR% %STDXALLOCATORBLOCKS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -ofbin\dscanner.exe goto eof :test_cmd @echo on set TESTNAME="bin\dscanner-unittest" -%DC% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -lib %TESTFLAGS% -of%TESTNAME%.lib +%DC% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% %STDXALLOCATOR% %STDXALLOCATORBLOCKS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -lib %TESTFLAGS% -of%TESTNAME%.lib if exist %TESTNAME%.lib %DC% %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -I"stdx-allocator\source" -unittest %TESTFLAGS% -of%TESTNAME%.exe if exist %TESTNAME%.exe %TESTNAME%.exe From f9fba3a011386dc07912090145e814f690babc35 Mon Sep 17 00:00:00 2001 From: Alien Date: Wed, 14 Feb 2018 01:57:57 -0500 Subject: [PATCH 7/8] Make splitting of lines for testing agnostic of a specific style. (#546) Make splitting of lines for testing agnostic of a specific style. merged-on-behalf-of: BBasile --- src/analysis/helpers.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/analysis/helpers.d b/src/analysis/helpers.d index 949a4e4..f379118 100644 --- a/src/analysis/helpers.d +++ b/src/analysis/helpers.d @@ -50,7 +50,6 @@ void assertAnalyzerWarnings(string code, const StaticAnalysisConfig config, { import analysis.run : parseModule; import dparse.lexer : StringCache, Token; - import std.ascii : newline; StringCache cache = StringCache(StringCache.defaultBucketCount); RollbackAllocator r; @@ -61,7 +60,7 @@ void assertAnalyzerWarnings(string code, const StaticAnalysisConfig config, // Run the code and get any warnings MessageSet rawWarnings = analyze("test", m, config, moduleCache, tokens); - string[] codeLines = code.split(newline); + string[] codeLines = code.splitLines(); // Get the warnings ordered by line string[size_t] warnings; From d7cf48f9cdcb29cb3f2e54446ec8b17fead2f800 Mon Sep 17 00:00:00 2001 From: some-bot <35382294+some-bot@users.noreply.github.com> Date: Sat, 17 Feb 2018 01:37:24 +0000 Subject: [PATCH 8/8] Updated libdparse to v0.8.0-alpha.5. --- dub.json | 2 +- libdparse | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index cda7dc8..cf61ec7 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "StdLoggerDisableWarning" ], "dependencies" : { - "libdparse" : "~>0.8.0-alpha.4", + "libdparse": "~>0.8.0-alpha.5", "dsymbol" : "~>0.3.0-alpha.3", "inifiled" : ">=1.0.2", "emsi_containers" : "~>0.6.0", diff --git a/libdparse b/libdparse index f3323ce..ee0fa01 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit f3323ce90a41c24cf874fd257ccbf6cc0b1be285 +Subproject commit ee0fa01ab74b6bf27bed3c7bdb9d6fb789963342