Add null terminator to string pointers (#77)
This commit is contained in:
parent
3bd9b5c8cd
commit
fdab43bee7
|
|
@ -11,6 +11,9 @@
|
||||||
# Sublime Text 2
|
# Sublime Text 2
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Idea stuff
|
||||||
|
.idea/
|
||||||
|
|
||||||
# Subversion
|
# Subversion
|
||||||
.svn/
|
.svn/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -502,14 +502,14 @@ void assertAnalyzerWarningsDMD(string code, const StaticAnalysisConfig config, b
|
||||||
|
|
||||||
global.params.useUnitTests = true;
|
global.params.useUnitTests = true;
|
||||||
global.path = new Strings();
|
global.path = new Strings();
|
||||||
global.path.push((dmdParentDir ~ "/dmd").ptr);
|
global.path.push((dmdParentDir ~ "/dmd" ~ "\0").ptr);
|
||||||
global.path.push((dmdParentDir ~ "/dmd/druntime/src").ptr);
|
global.path.push((dmdParentDir ~ "/dmd/druntime/src" ~ "\0").ptr);
|
||||||
|
|
||||||
initDMD();
|
initDMD();
|
||||||
|
|
||||||
auto input = cast(char[]) code;
|
auto input = cast(char[]) code;
|
||||||
input ~= '\0';
|
input ~= '\0';
|
||||||
auto t = dmd.frontend.parseModule(cast(const(char)[]) file, cast(const (char)[]) input);
|
auto t = dmd.frontend.parseModule(cast(const(char)[]) file, cast(const (char)[]) input);
|
||||||
if (semantic)
|
if (semantic)
|
||||||
t.module_.fullSemantic();
|
t.module_.fullSemantic();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -405,8 +405,8 @@ bool analyze(string[] fileNames, const StaticAnalysisConfig config, string error
|
||||||
|
|
||||||
global.params.useUnitTests = true;
|
global.params.useUnitTests = true;
|
||||||
global.path = new Strings();
|
global.path = new Strings();
|
||||||
global.path.push((dmdParentDir ~ "/dmd").ptr);
|
global.path.push((dmdParentDir ~ "/dmd" ~ "\0").ptr);
|
||||||
global.path.push((dmdParentDir ~ "/dmd/druntime/src").ptr);
|
global.path.push((dmdParentDir ~ "/dmd/druntime/src" ~ "\0").ptr);
|
||||||
|
|
||||||
initDMD();
|
initDMD();
|
||||||
|
|
||||||
|
|
@ -1245,7 +1245,7 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(FinalAttributeChecker!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(FinalAttributeChecker!ASTCodegen)(config))
|
||||||
visitors ~= new FinalAttributeChecker!ASTCodegen(fileName);
|
visitors ~= new FinalAttributeChecker!ASTCodegen(fileName);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(ImportSortednessCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(ImportSortednessCheck!ASTCodegen)(config))
|
||||||
visitors ~= new ImportSortednessCheck!ASTCodegen(fileName);
|
visitors ~= new ImportSortednessCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
|
|
@ -1254,10 +1254,10 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(RedundantAttributesCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(RedundantAttributesCheck!ASTCodegen)(config))
|
||||||
visitors ~= new RedundantAttributesCheck!ASTCodegen(fileName);
|
visitors ~= new RedundantAttributesCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(LengthSubtractionCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(LengthSubtractionCheck!ASTCodegen)(config))
|
||||||
visitors ~= new LengthSubtractionCheck!ASTCodegen(fileName);
|
visitors ~= new LengthSubtractionCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(AliasSyntaxCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(AliasSyntaxCheck!ASTCodegen)(config))
|
||||||
visitors ~= new AliasSyntaxCheck!ASTCodegen(fileName);
|
visitors ~= new AliasSyntaxCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
|
|
@ -1266,7 +1266,7 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(ConstructorCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(ConstructorCheck!ASTCodegen)(config))
|
||||||
visitors ~= new ConstructorCheck!ASTCodegen(fileName);
|
visitors ~= new ConstructorCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(AssertWithoutMessageCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(AssertWithoutMessageCheck!ASTCodegen)(config))
|
||||||
visitors ~= new AssertWithoutMessageCheck!ASTCodegen(
|
visitors ~= new AssertWithoutMessageCheck!ASTCodegen(
|
||||||
fileName,
|
fileName,
|
||||||
|
|
@ -1287,22 +1287,22 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
fileName,
|
fileName,
|
||||||
config.trust_too_much == Check.skipTests && !ut
|
config.trust_too_much == Check.skipTests && !ut
|
||||||
);
|
);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(AutoRefAssignmentCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(AutoRefAssignmentCheck!ASTCodegen)(config))
|
||||||
visitors ~= new AutoRefAssignmentCheck!ASTCodegen(fileName);
|
visitors ~= new AutoRefAssignmentCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(LogicPrecedenceCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(LogicPrecedenceCheck!ASTCodegen)(config))
|
||||||
visitors ~= new LogicPrecedenceCheck!ASTCodegen(
|
visitors ~= new LogicPrecedenceCheck!ASTCodegen(
|
||||||
fileName,
|
fileName,
|
||||||
config.logical_precedence_check == Check.skipTests && !ut
|
config.logical_precedence_check == Check.skipTests && !ut
|
||||||
);
|
);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(UnusedLabelCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(UnusedLabelCheck!ASTCodegen)(config))
|
||||||
visitors ~= new UnusedLabelCheck!ASTCodegen(
|
visitors ~= new UnusedLabelCheck!ASTCodegen(
|
||||||
fileName,
|
fileName,
|
||||||
config.unused_label_check == Check.skipTests && !ut
|
config.unused_label_check == Check.skipTests && !ut
|
||||||
);
|
);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(BuiltinPropertyNameCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(BuiltinPropertyNameCheck!ASTCodegen)(config))
|
||||||
visitors ~= new BuiltinPropertyNameCheck!ASTCodegen(fileName);
|
visitors ~= new BuiltinPropertyNameCheck!ASTCodegen(fileName);
|
||||||
|
|
||||||
|
|
@ -1335,7 +1335,7 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
fileName,
|
fileName,
|
||||||
config.static_if_else_check == Check.skipTests && !ut
|
config.static_if_else_check == Check.skipTests && !ut
|
||||||
);
|
);
|
||||||
|
|
||||||
if (moduleName.shouldRunDmd!(UselessAssertCheck!ASTCodegen)(config))
|
if (moduleName.shouldRunDmd!(UselessAssertCheck!ASTCodegen)(config))
|
||||||
visitors ~= new UselessAssertCheck!ASTCodegen(
|
visitors ~= new UselessAssertCheck!ASTCodegen(
|
||||||
fileName,
|
fileName,
|
||||||
|
|
@ -1345,7 +1345,7 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
|
||||||
foreach (visitor; visitors)
|
foreach (visitor; visitors)
|
||||||
{
|
{
|
||||||
m.accept(visitor);
|
m.accept(visitor);
|
||||||
|
|
||||||
foreach (message; visitor.messages)
|
foreach (message; visitor.messages)
|
||||||
set.insert(message);
|
set.insert(message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue