Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gdc-12 build #76

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9157c9b
Update README
RazvanN7 Jan 10, 2022
129324b
Add dmd-as-a-library submodule (#2)
RazvanN7 Jan 12, 2022
1973292
Add GH Actions build script (#4)
edi33416 Jan 26, 2022
2a2cb07
Removed libdparse from imports print functionality (#3)
lucica28 Jan 28, 2022
801297d
Fix failing tester + add unittest for imports (#7)
RazvanN7 Feb 2, 2022
1bd7b01
Add style checker (#9)
edi33416 Feb 3, 2022
e044d5b
Update action to build dlang fork
edi33416 Feb 10, 2022
7388c0d
Fix linter errors
edi33416 Feb 10, 2022
ad2f8d0
Add dmd dependencies to dub.json
edi33416 Feb 10, 2022
810992b
Add dmd dependencies to build.bat
edi33416 Feb 10, 2022
3e13a77
Replace libdparse in enum array functionality
lucica28 Apr 13, 2022
e802197
replace libdparse in objectconst functionality + unittests integratio…
lucica28 Jul 9, 2022
7dc76cb
replace libdparse in delete check (#21)
lucica28 Jul 20, 2022
ad68960
Update dmd (#23)
lucica28 Aug 10, 2022
8363e00
Update dmd (#25)
lucica28 Oct 6, 2022
9f931bd
Fix version flags for gdc and ldc2 (#32)
edi33416 Oct 27, 2022
a0c8d79
replace libparse in final attribute visitor (#34)
lucica28 Oct 30, 2022
d9a0187
update dmd (#37)
lucica28 Nov 1, 2022
d56c372
replace libparse in incorrect infinite range visitor (#33)
lucica28 Nov 1, 2022
bf8d3eb
update dmd (#39)
lucica28 Nov 4, 2022
8e3d94b
replace libdparse in imports sortedness visitor (#35)
lucica28 Nov 4, 2022
b739c0c
replace libdparse in redundant attributes visitor (#40)
lucica28 Nov 10, 2022
825f97c
replace libdparse in length subtraction visitor (#42)
lucica28 Nov 11, 2022
f215047
replace libdparse in explicitly annotated unittests check (#44)
lucica28 Nov 14, 2022
e24c84a
replace libdparse in alias style visitor (#38)
lucica28 Nov 14, 2022
2b1d3a1
update dmd (#48)
lucica28 Nov 18, 2022
7823d56
replace libdparse in constructor check (#43)
lucica28 Nov 25, 2022
faa3bd6
replace libdparse in local imports visitor (#45)
lucica28 Dec 1, 2022
e3ff3bd
replace libdpase in assert without msg visitor (#50)
lucica28 Dec 1, 2022
829eb94
replace libparse in opequals without tohash visitor (#53)
lucica28 Dec 2, 2022
5c54369
replace libdparse in auto ref assignment (#51)
lucica28 Dec 2, 2022
c3376d7
replace libdparse in logic precedence visitor (#54)
lucica28 Dec 2, 2022
d30c57b
replace libdparse in builtin properties visitor (#52)
lucica28 Dec 2, 2022
30f3f55
update dmd (#57)
lucica28 Dec 13, 2022
bd60179
replace libdparse in backwards range check (#58)
lucica28 Dec 16, 2022
016d6c3
update dmd and include the API needed for semantic analysis (#66)
lucica28 May 19, 2023
2f5c6b3
replace libdparse in redundant parens check (#61)
lucica28 May 22, 2023
34625a0
replace libdparse in statif if else visitor (#56)
lucica28 May 22, 2023
e6e4350
replace libdparse in useless assert (#63)
lucica28 May 24, 2023
f723149
replace libdparse in exception check (#68)
lucica28 May 25, 2023
da75445
replace libdparse in unused label check (#65)
lucica28 May 26, 2023
9a9d285
delete float operator check (#71)
lucica28 May 29, 2023
8360dab
replace libdparse in trust_too_much visitor (#70)
lucica28 May 29, 2023
8c50b17
Add null terminator to string pointers (#77)
Vladiwostok Nov 1, 2023
2b7d5ec
Replace libdparse in AsmStyleCheck (#75)
Vladiwostok Nov 7, 2023
c3c7ee1
Fix segfault caused by UnusedLabelCheck (#83)
Vladiwostok Dec 18, 2023
352fdb8
Fix gdc-12 build
Vladiwostok Oct 30, 2023
e85e6d4
Fix GDC config in makefile
Vladiwostok Nov 5, 2023
79e12a7
Extract compiler config creation in a separate make rule
Vladiwostok Dec 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ on:
push:
branches:
- master
- replace_libdparse

jobs:
main:
name: Run all tests

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

# Run permutations of common os + host compilers
strategy:
Expand Down Expand Up @@ -72,6 +73,10 @@ jobs:
submodules: 'recursive'
fetch-depth: 0

# Uncomment to get a ssh connection inside the GH Actions runner
#- name: Setup upterm session
# uses: lhotari/action-upterm@v1

# Install the host compiler (DMD or LDC)
# Also grabs DMD for GDC to include dub + rdmd
- name: Install ${{ matrix.compiler.version }}
Expand All @@ -87,6 +92,10 @@ jobs:
sudo apt-get install gdc-12 -y
gdc-12 --version

# - name: Setup upterm session
# if: ${{ matrix.build.type == 'make' && matrix.host == 'macos-latest'}}
# uses: lhotari/action-upterm@v1

# Compile D-Scanner and execute all tests without dub
- name: Build and test without dub
if: ${{ matrix.build.type == 'make' }}
Expand All @@ -99,7 +108,8 @@ jobs:
./build.bat
./build.bat test
else
make "-j$(nproc)" all test
NUM_PROC=$(nproc || getconf _NPROCESSORS_ONLN || 1)
make "-j$((NUM_PROC / 2))" all test
fi

# Compile D-Scanner and execute all tests using a specific dependency version
Expand Down Expand Up @@ -128,6 +138,11 @@ jobs:
fi
"./bin/dscanner$EXE" --config .dscanner.ini --styleCheck src

- name: Run style checks
if: ${{ matrix.compiler.dmd == 'dmd' && matrix.build.type == 'make' }}
run: |
make style

# Parse phobos to check for failures / crashes / ...
- name: Checkout Phobos
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# Sublime Text 2
*.sublime-workspace

# Idea stuff
.idea/

# Subversion
.svn/

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
[submodule "DCD"]
path = DCD
url = https://github.com/dlang-community/DCD.git
[submodule "dmd"]
path = dmd
url = [email protected]:dlang/dmd.git
2 changes: 1 addition & 1 deletion DCD
Submodule DCD updated 202 files
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# D-Scanner

[![CI status](https://travis-ci.org/dlang-community/D-Scanner.svg?branch=master)](https://travis-ci.org/dlang-community/D-Scanner/)
[![Latest version](https://img.shields.io/dub/v/dscanner.svg)](http://code.dlang.org/packages/dscanner)
[![License](https://img.shields.io/dub/l/dscanner.svg)](http://code.dlang.org/packages/dscanner)
# D-Scanner fork that uses dmd as a library (WIP)

D-Scanner is a tool for analyzing D source code

### Building and installing
First make sure that you have all the source code. Run ```git submodule update --init --recursive```

First, make sure that you have fetched the upstream: [email protected]:dlang-community/D-Scanner.git

```
git remote add upstream [email protected]:dlang-community/D-Scanner.git
git fetch upstream
```

Secondly, make sure that you have all the source code. Run ```git submodule update --init --recursive```
after cloning the project.

To build D-Scanner, run ```make``` (or the build.bat file on Windows).
Expand Down
96 changes: 91 additions & 5 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ if %githashsize% == 0 (
move /y bin\githash_.txt bin\githash.txt
)

set DFLAGS=-O -release -version=StdLoggerDisableWarning -Jbin %MFLAGS%
set TESTFLAGS=-g -w -version=StdLoggerDisableWarning -Jbin
set DFLAGS=-O -release -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -Jbin -Jdmd -Jdmd\compiler\src\dmd\res %MFLAGS%
set TESTFLAGS=-g -w -version=StdLoggerDisableWarning -version=CallbackAPI -version=DMDLIB -version=MARS -Jbin -Jdmd -Jdmd\compiler\src\dmd\res
set CORE=
set LIBDPARSE=
set STD=
Expand All @@ -29,6 +29,33 @@ set DSYMBOL=
set CONTAINERS=
set LIBDDOC=

SET DMD_FRONTEND_SRC=objc_glue.obj clone.obj transitivevisitor.obj iasm.obj iasmdmd.obj canthrow.obj tokens.obj optimize.obj func.obj semantic2.obj dvarstats.obj ph2.obj code.obj cdef.obj xmm.obj out.obj elfobj.obj glocal.obj dvec.obj code_x86.obj iasm2.obj string2.obj file2.obj obj.obj go.obj inliner.obj cc.obj bcomplex.obj mscoffobj.obj ptrntab.obj dlist.obj pdata.obj fp.obj cod3.obj os.obj cgelem.obj dcode.obj disasm86.obj exh.obj blockopt.obj aarray.obj cg.obj newman.obj dwarfdbginf.obj codebuilder.obj var.obj cod2.obj machobj.obj cgobj.obj cod4.obj dtype.obj cv4.obj backend.obj el.obj cgcod.obj cv8.obj dwarf.obj evalu8.obj ty.obj mem.obj cgxmm.obj gdag.obj gother.obj goh.obj cgcv.obj debugprint.obj cgsched.obj dwarfeh.obj cgreg.obj backconfig.obj gloop.obj divcoeff.obj cod5.obj dwarf2.obj cg87.obj nteh.obj dcgcv.obj util2.obj compress.obj type.obj elpicpie.obj gsroa.obj cgcs.obj ee.obj symbol.obj barray.obj melf.obj oper.obj cgcse.obj rtlsym.obj mscoff.obj drtlsym.obj symtab.obj dt.obj mach.obj cod1.obj global.obj filespec.obj gflow.obj elem.obj cgen.obj md5.obj chkformat.obj argtypes_sysv_x64.obj sideeffect.obj denum.obj apply.obj e2ir.obj typinf.obj statement.obj arraytypes.obj blockexit.obj init.obj scanomf.obj utils.obj parsetimevisitor.obj errorsink.obj scanmscoff.obj initsem.obj arrayop.obj nogc.obj dsymbol.obj hdrgen.obj dmangle.obj astenums.obj libmscoff.obj compiler.obj foreachvar.obj scanmach.obj dcast.obj tocsym.obj tocvdebug.obj semantic3.obj builtin.obj sapply.obj printast.obj dtemplate.obj importc.obj file_manager.obj dclass.obj argtypes_x86.obj glue.obj statement_rewrite_walker.obj target.obj aggregate.obj stringtable.obj ctfloat.obj response.obj strtold.obj port.obj aav.obj env.obj optional.obj filename.obj man.obj rootobject.obj complex.obj hash.obj region.obj utf.obj speller.obj rmem.obj array.obj longdouble.obj bitarray.obj eh.obj strictvisitor.obj permissivevisitor.obj lambdacomp.obj ctfeexpr.obj cparse.obj imphint.obj delegatize.obj access.obj identifier.obj todt.obj dmsc.obj entity.obj impcnvtab.obj dimport.obj lexer.obj dinifile.obj libomf.obj vsoptions.obj dstruct.obj aliasthis.obj ctorflow.obj errors.obj astcodegen.obj mtype.obj dtoh.obj argtypes_aarch64.obj cpreprocess.obj dmdparams.obj lib.obj id.obj parse.obj doc.obj scanelf.obj iasmgcc.obj cppmanglewin.obj stmtstate.obj ob.obj expression.obj declaration.obj location.obj dinterpret.obj inline.obj bitfields.obj string.obj int128.obj file.obj outbuffer.obj nspace.obj gluelayer.obj json.obj toir.obj intrange.obj cond.obj constfold.obj dversion.obj staticassert.obj dmodule.obj traits.obj opover.obj link.obj toctype.obj staticcond.obj statementsem.obj globals.obj libmach.obj toobj.obj s2ir.obj inlinecost.obj objc.obj visitor.obj asttypename.obj mustuse.obj dsymbolsem.obj frontend.obj safe.obj dscope.obj attrib.obj ast_node.obj escape.obj cli.obj templateparamsem.obj libelf.obj console.obj cppmangle.obj astbase.obj dmacro.obj typesem.obj expressionsem.obj

set DMD_ROOT_SRC=
for %%x in (dmd\compiler\src\dmd\common\*.d) do set DMD_ROOT_SRC=!DMD_ROOT_SRC! %%x
for %%x in (dmd\compiler\src\dmd\root\*.d) do set DMD_ROOT_SRC=!DMD_ROOT_SRC! %%x

set DMD_LEXER_SRC=^
dmd\compiler\src\dmd\console.d ^
dmd\compiler\src\dmd\entity.d ^
dmd\compiler\src\dmd\errors.d ^
dmd\compiler\src\dmd\file_manager.d ^
dmd\compiler\src\dmd\globals.d ^
dmd\compiler\src\dmd\id.d ^
dmd\compiler\src\dmd\identifier.d ^
dmd\compiler\src\dmd\lexer.d ^
dmd\compiler\src\dmd\tokens.d ^
dmd\compiler\src\dmd\utils.d

set DMD_PARSER_SRC=^
dmd\compiler\src\dmd\astbase.d ^
dmd\compiler\src\dmd\parse.d ^
dmd\compiler\src\dmd\parsetimevisitor.d ^
dmd\compiler\src\dmd\transitivevisitor.d ^
dmd\compiler\src\dmd\permissivevisitor.d ^
dmd\compiler\src\dmd\strictvisitor.d ^
dmd\compiler\src\dmd\astenums.d

for %%x in (src\dscanner\*.d) do set CORE=!CORE! %%x
for %%x in (src\dscanner\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x
for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x
Expand All @@ -42,17 +69,76 @@ for %%x in (DCD\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 (dmd\compiler\src\dmd\common\*.d) do %DC% %DFLAGS% -c %%x -od. -I"dmd\compiler\src"
for %%x in (dmd\compiler\src\dmd\root\*.d) do %DC% %DFLAGS% -c %%x -od. -I"dmd\compiler\src"
for %%x in (dmd\compiler\src\dmd\backend\*.d) do %DC% %DFLAGS% -c %%x -od. -I"dmd\compiler\src"
for %%x in (dmd\compiler\src\dmd\*.d) do %DC% %DFLAGS% -c %%x -od. -I"dmd\compiler\src"

%DC% %DFLAGS% -c dmd\compiler\src\dmd\backend\iasm.d -od. -ofiasm2.obj -I"dmd\compiler\src"
%DC% %DFLAGS% -c dmd\compiler\src\dmd\common\string.d -od. -ofstring2.obj -I"dmd\compiler\src"
%DC% %DFLAGS% -c dmd\compiler\src\dmd\common\file.d -od. -offile2.obj -I"dmd\compiler\src"

if "%1" == "test" goto test_cmd

@echo on
%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
dir
echo %DMD_FRONTEND_SRC%

%DC% %MFLAGS%^
%CORE%^
%STD%^
%LIBDPARSE%^
%LIBDDOC%^
%ANALYSIS%^
%INIFILED%^
%DSYMBOL%^
%CONTAINERS%^
%DMD_FRONTEND_SRC%^
%DFLAGS%^
-I"libdparse\src"^
-I"DCD\dsymbol\src"^
-I"containers\src"^
-I"libddoc\src"^
-I"libddoc\common\source"^
-I"dmd\compiler\src"^
-ofbin\dscanner.exe
goto eof

:test_cmd
@echo on
set TESTNAME="bin\dscanner-unittest"
%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
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
%DC% %MFLAGS% ^
%STD%^
%LIBDPARSE%^
%LIBDDOC%^
%INIFILED%^
%DSYMBOL%^
%CONTAINERS%^
%DMD_FRONTEND_SRC%^
-I"libdparse\src"^
-I"DCD\dsymbol\src"^
-I"containers\src"^
-I"libddoc\src"^
-I"dmd\compiler\src"^
-I"dmd\compiler\src\dmd\res"^
-lib %TESTFLAGS%^
-of%TESTNAME%.lib
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"^
-I"dmd\compiler\src"^
-I"dmd\compiler\src\dmd\res"^
-unittest^
%TESTFLAGS%^
-of%TESTNAME%.exe
if exist %TESTNAME%.exe %TESTNAME%.exe

if exist %TESTNAME%.obj del %TESTNAME%.obj
Expand Down
1 change: 1 addition & 0 deletions changelog/dscanner.assert-without-message.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid checking `enforce` calls as it is phobos specific.
19 changes: 19 additions & 0 deletions changelog/dscanner.struct-ctor-check.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Remove the check regarding structs with no arguments constructors.

The check is implemented in constructors.d and it warns against the usage
of both constructors with all parameters with default values and constructors
without any arguments, as this might be confusing. This scenario, for structs,
is no longer D valid code and that's why it is being deprecated.

Let's consider the following code:

---
struct Dog
{
this() {}
this(string name = "doggie") {} // [warn]: This struct constructor can never be called with its default argument.
}
---

D-Scanner would throw and error for this particular struct, but this code
does not compile anymore hence this check is not needed anymore/
1 change: 1 addition & 0 deletions dmd
Submodule dmd added at a42203
6 changes: 5 additions & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
"dcd:dsymbol" : "~>0.15.0-beta.1",
"inifiled" : "~>1.3.1",
"emsi_containers" : "~>0.9.0",
"libddoc" : "~>0.8.0"
"libddoc" : "~>0.8.0",
"dmd": {
"repository": "git+https://github.com/dlang/dmd.git",
"version": "a4220358ecfcffe7ea38ab4a1996ffc5a5331f22"
}
},
"targetPath" : "bin",
"stringImportPaths" : [
Expand Down
2 changes: 1 addition & 1 deletion inifiled
Loading
Loading