Skip to content

Commit d6ff24a

Browse files
committed
Merge branch 'replace_libdparse'
2 parents 796d212 + b4a9a14 commit d6ff24a

File tree

83 files changed

+6668
-7781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6668
-7781
lines changed

.github/workflows/default.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ on:
66
push:
77
branches:
88
- master
9+
- replace_libdparse
910

1011
jobs:
1112
main:
1213
name: Run all tests
1314

1415
# Only run for the main repository - not forks
15-
if: ${{ github.repository == 'dlang-community/D-Scanner' }}
16+
if: ${{ github.repository == 'Dlang-UPB/D-Scanner' }}
1617

1718
# Run permutations of common os + host compilers
1819
strategy:
@@ -87,6 +88,10 @@ jobs:
8788
submodules: 'recursive'
8889
fetch-depth: 0
8990

91+
# Uncomment to get a ssh connection inside the GH Actions runner
92+
#- name: Setup upterm session
93+
# uses: lhotari/action-upterm@v1
94+
9095
# Install the host compiler (DMD or LDC)
9196
# Also grabs DMD for GDC to include dub + rdmd
9297
- name: Install ${{ matrix.compiler.version }}
@@ -102,6 +107,10 @@ jobs:
102107
sudo apt-get install gdc-12 -y
103108
gdc-12 --version
104109
110+
# - name: Setup upterm session
111+
# if: ${{ matrix.build.type == 'dub' && matrix.host == 'macos-latest'}}
112+
# uses: lhotari/action-upterm@v1
113+
105114
# Compile D-Scanner and execute all tests without dub
106115
- name: Build and test without dub
107116
if: ${{ matrix.build.type == 'make' }}
@@ -114,7 +123,8 @@ jobs:
114123
./build.bat
115124
./build.bat test
116125
else
117-
make "-j$(nproc)" all test
126+
NUM_PROC=$(nproc || getconf _NPROCESSORS_ONLN || 1)
127+
make "-j$((NUM_PROC / 2))" all test
118128
fi
119129
120130
# Compile D-Scanner and execute all tests using a specific dependency version
@@ -135,7 +145,7 @@ jobs:
135145
dub build
136146
dub test
137147
138-
- uses: actions/upload-artifact@v2
148+
- uses: actions/upload-artifact@v4
139149
with:
140150
name: bin-${{matrix.build.type}}-${{matrix.build.version}}-${{ matrix.compiler.dmd }}-${{ matrix.host }}
141151
path: bin
@@ -159,10 +169,21 @@ jobs:
159169
"./bin/dscanner$EXE" --styleCheck -f "$FORMAT" src
160170
161171
- name: Integration Tests
162-
run: ./it.sh
172+
# run: ./it.sh
173+
run: |
174+
if [ "$RUNNER_OS" == "Windows" ]; then
175+
./it.sh Windows
176+
else
177+
./it.sh Unix
178+
fi
163179
working-directory: tests
164180
shell: bash
165181

182+
- name: Run style checks
183+
if: ${{ matrix.compiler.dmd == 'dmd' && matrix.build.type == 'make' }}
184+
run: |
185+
make style
186+
166187
# Parse phobos to check for failures / crashes / ...
167188
- name: Checkout Phobos
168189
uses: actions/checkout@v4
@@ -171,7 +192,7 @@ jobs:
171192
path: phobos
172193

173194
- name: Apply D-Scanner to Phobos
174-
if: ${{ matrix.build.version != 'min libdparse'}} # Older versions crash with "Invalid UTF..."
195+
if: ${{ matrix.build.version != 'min libdparse'}} # Older versions crash with "Invalid UTF..."
175196
working-directory: phobos
176197
shell: bash
177198
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# Sublime Text 2
1212
*.sublime-workspace
1313

14+
# Idea stuff
15+
.idea/
16+
1417
# Subversion
1518
.svn/
1619

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@
1717
[submodule "DCD"]
1818
path = DCD
1919
url = https://github.com/dlang-community/DCD.git
20+
[submodule "dmd"]
21+
path = dmd
22+
url = git@github.com:dlang/dmd.git

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
D-Scanner is a tool for analyzing D source code
88

99
### Building and installing
10-
First make sure that you have all the source code. Run ```git submodule update --init --recursive```
10+
11+
First, make sure that you have fetched the upstream: git@github.com:dlang-community/D-Scanner.git
12+
13+
```
14+
git remote add upstream git@github.com:dlang-community/D-Scanner.git
15+
git fetch upstream
16+
```
17+
18+
Secondly, make sure that you have all the source code. Run ```git submodule update --init --recursive```
1119
after cloning the project.
1220

1321
To build D-Scanner, run ```make``` (or the build.bat file on Windows).

build.bat

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if %githashsize% == 0 (
1818
move /y bin\githash_.txt bin\githash.txt
1919
)
2020

21-
set DFLAGS=-O -release -Jbin %MFLAGS%
22-
set TESTFLAGS=-g -w -Jbin
21+
set DFLAGS=-O -release -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -version=NoBackend -version=NoMain -Jbin -Jdmd -Jdmd\compiler\src\dmd\res %MFLAGS%
22+
set TESTFLAGS=-g -w -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -version=NoBackend -version=NoMain -Jbin -Jdmd -Jdmd\compiler\src\dmd\res
2323
set CORE=
2424
set LIBDPARSE=
2525
set STD=
@@ -29,6 +29,44 @@ set DSYMBOL=
2929
set CONTAINERS=
3030
set LIBDDOC=
3131

32+
set DMD_FRONTEND_DENYLIST=^
33+
dmd\compiler\src\dmd\mars.d^
34+
dmd\compiler\src\dmd\dmsc.d^
35+
dmd\compiler\src\dmd\e2ir.d^
36+
dmd\compiler\src\dmd\eh.d^
37+
dmd\compiler\src\dmd\glue.d^
38+
dmd\compiler\src\dmd\iasmdmd.d^
39+
dmd\compiler\src\dmd\irstate.d^
40+
dmd\compiler\src\dmd\lib.d^
41+
dmd\compiler\src\dmd\libelf.d^
42+
dmd\compiler\src\dmd\libmach.d^
43+
dmd\compiler\src\dmd\libmscoff.d^
44+
dmd\compiler\src\dmd\libomf.d^
45+
dmd\compiler\src\dmd\objc_glue.d^
46+
dmd\compiler\src\dmd\s2ir.d^
47+
dmd\compiler\src\dmd\scanelf.d^
48+
dmd\compiler\src\dmd\scanmach.d^
49+
dmd\compiler\src\dmd\scanmscoff.d^
50+
dmd\compiler\src\dmd\scanomf.d^
51+
dmd\compiler\src\dmd\tocsym.d^
52+
dmd\compiler\src\dmd\toctype.d^
53+
dmd\compiler\src\dmd\tocvdebug.d^
54+
dmd\compiler\src\dmd\toobj.d^
55+
dmd\compiler\src\dmd\todt.d^
56+
dmd\compiler\src\dmd\toir.d
57+
58+
set DMD_FRONTEND_SRC=
59+
for %%x in (dmd\compiler\src\dmd\common\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
60+
for %%x in (dmd\compiler\src\dmd\root\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
61+
for %%x in (dmd\compiler\src\dmd\visitor\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
62+
for %%x in (dmd\compiler\src\dmd\mangle\*.d) do set DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x
63+
for %%x in (dmd\compiler\src\dmd\*.d) do (
64+
echo "%DMD_FRONTEND_DENYLIST%" | findstr /i /c:"%%x" >nul
65+
if errorlevel 1 (
66+
set "DMD_FRONTEND_SRC=!DMD_FRONTEND_SRC! %%x"
67+
)
68+
)
69+
3270
for %%x in (src\dscanner\*.d) do set CORE=!CORE! %%x
3371
for %%x in (src\dscanner\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x
3472
for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
@@ -45,14 +83,62 @@ for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINER
4583
if "%1" == "test" goto test_cmd
4684

4785
@echo on
48-
%DC% %MFLAGS% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"DCD\dsymbol\src" -I"containers\src" -I"libddoc\src" -I"libddoc\common\source" -ofbin\dscanner.exe
86+
%DC% %MFLAGS%^
87+
%CORE%^
88+
%STD%^
89+
%LIBDPARSE%^
90+
%LIBDDOC%^
91+
%ANALYSIS%^
92+
%INIFILED%^
93+
%DSYMBOL%^
94+
%CONTAINERS%^
95+
%DMD_FRONTEND_SRC%^
96+
%DFLAGS%^
97+
-Ilibdparse\src^
98+
-IDCD\dsymbol\src^
99+
-Icontainers\src^
100+
-Ilibddoc\src^
101+
-Ilibddoc\common\source^
102+
-Idmd\compiler\src^
103+
-ofbin\dscanner.exe
49104
goto eof
50105

51106
:test_cmd
52107
@echo on
53108
set TESTNAME="bin\dscanner-unittest"
54-
%DC% %MFLAGS% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"DCD\dsymbol\src" -I"containers\src" -I"libddoc\src" -lib %TESTFLAGS% -of%TESTNAME%.lib
55-
if exist %TESTNAME%.lib %DC% %MFLAGS% %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"DCD\dsymbol\src" -I"containers\src" -I"libddoc\src" -I"libddoc\common\source" -unittest %TESTFLAGS% -of%TESTNAME%.exe
109+
%DC% %MFLAGS% ^
110+
%STD%^
111+
%LIBDPARSE%^
112+
%LIBDDOC%^
113+
%INIFILED%^
114+
%DSYMBOL%^
115+
%CONTAINERS%^
116+
%DMD_FRONTEND_SRC%^
117+
-I"libdparse\src"^
118+
-I"DCD\dsymbol\src"^
119+
-I"containers\src"^
120+
-I"libddoc\src"^
121+
-I"dmd\compiler\src"^
122+
-I"dmd\compiler\src\dmd\res"^
123+
%TESTFLAGS%^
124+
-lib^
125+
-of%TESTNAME%.lib
126+
if exist %TESTNAME%.lib %DC% %MFLAGS%^
127+
%CORE%^
128+
%ANALYSIS%^
129+
%TESTNAME%.lib^
130+
-I"src"^
131+
-I"inifiled\source"^
132+
-I"libdparse\src"^
133+
-I"DCD\dsymbol\src"^
134+
-I"containers\src"^
135+
-I"libddoc\src"^
136+
-I"libddoc\common\source"^
137+
-I"dmd\compiler\src"^
138+
-I"dmd\compiler\src\dmd\res"^
139+
-unittest^
140+
%TESTFLAGS%^
141+
-of%TESTNAME%.exe
56142
if exist %TESTNAME%.exe %TESTNAME%.exe
57143

58144
if exist %TESTNAME%.obj del %TESTNAME%.obj
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid checking `enforce` calls as it is phobos specific.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove the check for comma expression check
2+
e.g. (int a = 3, a + 7)
3+
This check is no longer necessary since comma expression have been removed from the D language.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the check for duplicate attributes (@property, @safe, @trusted, @system, pure, nothrow).
2+
This check is no longer necessary since having duplicated attributes is now a compiler error.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove IfStatementCheck, as it has been disabled in 2015 due to false positives and untouched ever since then.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Remove the check regarding structs with no arguments constructors.
2+
3+
The check is implemented in constructors.d and it warns against the usage
4+
of both constructors with all parameters with default values and constructors
5+
without any arguments, as this might be confusing. This scenario, for structs,
6+
is no longer D valid code and that's why it is being deprecated.
7+
8+
Let's consider the following code:
9+
10+
---
11+
struct Dog
12+
{
13+
this() {}
14+
this(string name = "doggie") {} // [warn]: This struct constructor can never be called with its default argument.
15+
}
16+
---
17+
18+
D-Scanner would throw and error for this particular struct, but this code
19+
does not compile anymore hence this check is not needed anymore/

0 commit comments

Comments
 (0)