Skip to content

Commit

Permalink
make deinitializeDMD reset onlyOneMain check
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilsonator committed Nov 22, 2024
1 parent 3fa3ac8 commit ec99c29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions compiler/src/dmd/frontend.d
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,13 @@ void deinitializeDMD()
import dmd.objc : Objc;
import dmd.target : target;
import dmd.errors : diagnostics;
import dmd.glue : resetLastMain;

diagnosticHandler = null;
fatalErrorHandler = null;

global.deinitialize();
resetLastMain();

Type.deinitialize();
Id.deinitialize();
Expand Down
8 changes: 7 additions & 1 deletion compiler/src/dmd/glue.d
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,13 @@ private bool entryPointFunctions(Obj objmod, FuncDeclaration fd)
return false;
}

void resetLastMain()
{
lastMain = null;
}

private __gshared FuncDeclaration lastMain;

/****************************************
* Only one entry point function is allowed. Print error if more than one.
* Params:
Expand All @@ -1632,7 +1639,6 @@ private bool entryPointFunctions(Obj objmod, FuncDeclaration fd)
*/
private bool onlyOneMain(FuncDeclaration fd)
{
__gshared FuncDeclaration lastMain;
if (lastMain)
{
const format = (target.os == Target.OS.Windows)
Expand Down

0 comments on commit ec99c29

Please sign in to comment.