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
Implemented feature 767 (ready for review & pull) #1839
Changes from all commits
00ed71a
ab3f315
058ab8d
9085036
9ea48b9
f4aa30f
63623af
e025f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1038,12 +1038,24 @@ void PragmaDeclaration::semantic(Scope *sc) | |
StringExp *se = e->toString(); | ||
if (!se) | ||
error("string expected for library name, not '%s'", e->toChars()); | ||
else if (global.params.verbose) | ||
else | ||
{ | ||
char *name = (char *)mem.malloc(se->len + 1); | ||
memcpy(name, se->string, se->len); | ||
name[se->len] = 0; | ||
printf("library %s\n", name); | ||
if (global.params.verbose) | ||
printf("library %s\n", name); | ||
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. I mean here :o) |
||
if (global.params.moduleDeps && !global.params.moduleDepsFile) | ||
{ | ||
OutBuffer *ob = global.params.moduleDeps; | ||
ob->writestring("depsLib "); | ||
ob->writestring(sc->module->toPrettyChars()); | ||
ob->writestring(" ("); | ||
escapePath(ob, sc->module->srcfile->toChars()); | ||
ob->writestring(") : "); | ||
ob->writestring((char *) name); | ||
ob->writenl(); | ||
} | ||
mem.free(name); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,16 +84,41 @@ DebugCondition::DebugCondition(Module *mod, unsigned level, Identifier *ident) | |
{ | ||
} | ||
|
||
// Helper for printing dependency information | ||
void printDepsConditional(Scope *sc, DVCondition* condition, const char* depType) | ||
{ | ||
if (!global.params.moduleDeps || global.params.moduleDepsFile) | ||
return; | ||
OutBuffer *ob = global.params.moduleDeps; | ||
Module* md = sc && sc->module ? sc->module : condition->mod; | ||
if (!md) | ||
return; | ||
ob->writestring(depType); | ||
ob->writestring(md->toPrettyChars()); | ||
ob->writestring(" ("); | ||
escapePath(ob, md->srcfile->toChars()); | ||
ob->writestring(") : "); | ||
if (condition->ident) | ||
ob->printf("%s\n", condition->ident->toChars()); | ||
else | ||
ob->printf("%d\n", condition->level); | ||
} | ||
|
||
|
||
int DebugCondition::include(Scope *sc, ScopeDsymbol *s) | ||
{ | ||
//printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel); | ||
if (inc == 0) | ||
{ | ||
inc = 2; | ||
bool definedInModule = false; | ||
if (ident) | ||
{ | ||
if (findCondition(mod->debugids, ident)) | ||
{ | ||
inc = 1; | ||
definedInModule = true; | ||
} | ||
else if (findCondition(global.params.debugids, ident)) | ||
inc = 1; | ||
else | ||
|
@@ -104,6 +129,8 @@ int DebugCondition::include(Scope *sc, ScopeDsymbol *s) | |
} | ||
else if (level <= global.params.debuglevel || level <= mod->debuglevel) | ||
inc = 1; | ||
if (!definedInModule) | ||
printDepsConditional(sc, this, "depsDebug "); | ||
} | ||
return (inc == 1); | ||
} | ||
|
@@ -123,7 +150,7 @@ void VersionCondition::setGlobalLevel(unsigned level) | |
global.params.versionlevel = level; | ||
} | ||
|
||
void VersionCondition::checkPredefined(Loc loc, const char *ident) | ||
bool VersionCondition::isPredefined(const char *ident) | ||
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. could this be made const? 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. it is static. |
||
{ | ||
static const char* reserved[] = | ||
{ | ||
|
@@ -211,16 +238,12 @@ void VersionCondition::checkPredefined(Loc loc, const char *ident) | |
for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) | ||
{ | ||
if (strcmp(ident, reserved[i]) == 0) | ||
goto Lerror; | ||
return true; | ||
} | ||
|
||
if (ident[0] == 'D' && ident[1] == '_') | ||
goto Lerror; | ||
|
||
return; | ||
|
||
Lerror: | ||
error(loc, "version identifier '%s' is reserved and cannot be set", ident); | ||
return true; | ||
return false; | ||
} | ||
|
||
void VersionCondition::addGlobalIdent(const char *ident) | ||
|
@@ -249,10 +272,14 @@ int VersionCondition::include(Scope *sc, ScopeDsymbol *s) | |
if (inc == 0) | ||
{ | ||
inc = 2; | ||
bool definedInModule=false; | ||
if (ident) | ||
{ | ||
if (findCondition(mod->versionids, ident)) | ||
{ | ||
inc = 1; | ||
definedInModule = true; | ||
} | ||
else if (findCondition(global.params.versionids, ident)) | ||
inc = 1; | ||
else | ||
|
@@ -264,6 +291,8 @@ int VersionCondition::include(Scope *sc, ScopeDsymbol *s) | |
} | ||
else if (level <= global.params.versionlevel || level <= mod->versionlevel) | ||
inc = 1; | ||
if (!definedInModule && (!ident || (!isPredefined(ident->toChars()) && ident != Lexer::idPool(Token::toChars(TOKunittest)) && ident != Lexer::idPool(Token::toChars(TOKassert))))) | ||
printDepsConditional(sc, this, "depsVersion "); | ||
} | ||
return (inc == 1); | ||
} | ||
|
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.
why the extra whitespace?