-
Notifications
You must be signed in to change notification settings - Fork 80
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
Draft: Use @safe and @trusted #840
Open
nordlow
wants to merge
16
commits into
dlang-community:master
Choose a base branch
from
nordlow:make-safe
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ea25aad
Use @safe: at the beginning
e952076
Bump dsymbol dep
nordlow 542a122
Bump dsymbol
nordlow 2395c38
Adjust makefile debug target
nordlow 1b759da
Revert changes to makefile
nordlow 51eda85
Bump dsymbol
nordlow 2601b15
Revert whitespace changes
nordlow 815dcad
Revert changes to makefile
nordlow 9454a1c
Replace spaces with tabs
nordlow 8be0e04
Replace spaces with tabs
nordlow 3a819da
Remove spaces
nordlow 9f42e54
Use more tabs
nordlow 488cec5
Use more tabs
nordlow d9a05f2
Use tabs
nordlow 0a2ad29
More tabs
nordlow 1ae1e05
Correct indentation of main
nordlow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule dsymbol
updated
16 files
+2 −0 | src/dsymbol/builtin/names.d | |
+16 −14 | src/dsymbol/builtin/symbols.d | |
+3 −1 | src/dsymbol/cache_entry.d | |
+152 −143 | src/dsymbol/conversion/first.d | |
+17 −15 | src/dsymbol/conversion/package.d | |
+34 −33 | src/dsymbol/conversion/second.d | |
+8 −7 | src/dsymbol/deferred.d | |
+2 −0 | src/dsymbol/import_.d | |
+63 −0 | src/dsymbol/makex.d | |
+41 −28 | src/dsymbol/modulecache.d | |
+9 −7 | src/dsymbol/scope_.d | |
+32 −35 | src/dsymbol/semantic.d | |
+4 −2 | src/dsymbol/string_interning.d | |
+13 −12 | src/dsymbol/symbol.d | |
+3 −2 | src/dsymbol/tests.d | |
+5 −3 | src/dsymbol/type_lookup.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,7 +277,7 @@ unittest | |
assertAnalyzerWarnings(q{ | ||
unittest | ||
{ | ||
@safe: | ||
|
||
@safe void foo(); | ||
@system | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,12 +37,14 @@ import inifiled; | |
|
||
import dsymbol.modulecache; | ||
|
||
@safe: | ||
|
||
version (unittest) | ||
void main() | ||
void main() @trusted | ||
{ | ||
} | ||
else | ||
int main(string[] args) | ||
int main(string[] args) @trusted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the point of this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't main be |
||
{ | ||
bool sloc; | ||
bool highlight; | ||
|
@@ -74,48 +76,55 @@ else | |
try | ||
{ | ||
// dfmt off | ||
() @trusted { | ||
getopt(args, std.getopt.config.caseSensitive, | ||
"sloc|l", &sloc, | ||
"highlight", &highlight, | ||
"ctags|c", &ctags, | ||
"help|h", &help, | ||
"etags|e", &etags, | ||
"etagsAll", &etagsAll, | ||
"tokenCount|t", &tokenCount, | ||
"syntaxCheck|s", &syntaxCheck, | ||
"ast|xml", &ast, | ||
"imports|i", &imports, | ||
"recursiveImports", &recursiveImports, | ||
"outline|o", &outline, | ||
"tokenDump", &tokenDump, | ||
"styleCheck|S", &styleCheck, | ||
"defaultConfig", &defaultConfig, | ||
"declaration|d", &symbolName, | ||
"config", &configLocation, | ||
"report", &report, | ||
"reportFormat", &reportFormat, | ||
"reportFile", &reportFile, | ||
"I", &importPaths, | ||
"version", &printVersion, | ||
"muffinButton", &muffin, | ||
"explore", &explore, | ||
"skipTests", &skipTests, | ||
"errorFormat|f", &errorFormat); | ||
"sloc|l", &sloc, | ||
"highlight", &highlight, | ||
"ctags|c", &ctags, | ||
"help|h", &help, | ||
"etags|e", &etags, | ||
"etagsAll", &etagsAll, | ||
"tokenCount|t", &tokenCount, | ||
"syntaxCheck|s", &syntaxCheck, | ||
"ast|xml", &ast, | ||
"imports|i", &imports, | ||
"recursiveImports", &recursiveImports, | ||
"outline|o", &outline, | ||
"tokenDump", &tokenDump, | ||
"styleCheck|S", &styleCheck, | ||
"defaultConfig", &defaultConfig, | ||
"declaration|d", &symbolName, | ||
"config", &configLocation, | ||
"report", &report, | ||
"reportFormat", &reportFormat, | ||
"reportFile", &reportFile, | ||
"I", &importPaths, | ||
"version", &printVersion, | ||
"muffinButton", &muffin, | ||
"explore", &explore, | ||
"skipTests", &skipTests, | ||
"errorFormat|f", &errorFormat); | ||
} (); | ||
//dfmt on | ||
} | ||
catch (ConvException e) | ||
{ | ||
stderr.writeln(e.msg); | ||
() @trusted { | ||
stderr.writeln(e.msg); | ||
} (); | ||
return 1; | ||
} | ||
catch (GetOptException e) | ||
{ | ||
stderr.writeln(e.msg); | ||
() @trusted { | ||
stderr.writeln(e.msg); | ||
} (); | ||
return 1; | ||
} | ||
|
||
if (muffin) | ||
{ | ||
() @trusted { | ||
stdout.writeln(` ___________ | ||
__(#*O 0** @%*)__ | ||
_(%*o#*O%*0 #O#%##@)_ | ||
|
@@ -125,13 +134,16 @@ else | |
|I|I|I|I|I|I|I|I|I|I| | ||
|I|I|I|I|I|I|I|I|I|I| | ||
|I|I|I|I|I|I|I|I|I|I|`); | ||
} (); | ||
return 0; | ||
} | ||
|
||
if (explore) | ||
{ | ||
() @trusted { | ||
stdout.writeln("D-Scanner: Scanning..."); | ||
stderr.writeln("D-Scanner: No new astronomical objects discovered."); | ||
} (); | ||
return 1; | ||
} | ||
|
||
|
@@ -153,7 +165,7 @@ else | |
const(string[]) absImportPaths = importPaths.map!(a => a.absolutePath() | ||
.buildNormalizedPath()).array(); | ||
|
||
auto alloc = scoped!(dsymbol.modulecache.ASTAllocator)(); | ||
scope alloc = () @trusted { return new dsymbol.modulecache.ASTAllocator(); } (); | ||
auto moduleCache = ModuleCache(alloc); | ||
|
||
if (absImportPaths.length) | ||
|
@@ -328,7 +340,7 @@ else | |
return 0; | ||
} | ||
|
||
void printHelp(string programName) | ||
void printHelp(string programName) @trusted | ||
{ | ||
stderr.writefln(` | ||
Usage: %s <options> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this accept call can generally be
@trust
ed, this should probably stay@system