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

remove errors.d from mars.d #16565

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions compiler/src/dmd/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@
if (params.jsonFieldFlags)
{
Modules modules; // empty
generateJson(modules);
if (generateJson(modules, global.errorSink))
fatal();

Check warning on line 341 in compiler/src/dmd/main.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/main.d#L341

Added line #L341 was not covered by tests
return EXIT_SUCCESS;
}
usage();
Expand Down Expand Up @@ -625,7 +626,8 @@
// Generate output files
if (params.json.doOutput)
{
generateJson(modules);
if (generateJson(modules, global.errorSink))
fatal();

Check warning on line 630 in compiler/src/dmd/main.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/main.d#L630

Added line #L630 was not covered by tests
}
if (!global.errors && params.ddoc.doOutput)
{
Expand Down
19 changes: 14 additions & 5 deletions compiler/src/dmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,15 @@ Where:
%.*s", cast(int)inifileCanon.length, inifileCanon.ptr, cast(int)help.length, &help[0]);
}

extern (C++) void generateJson(ref Modules modules)
/*******************************************
* Generate JSON file.
* Params:
* modules = Modules
* eSink = error message sink
* Returns:
* true on error
*/
extern (C++) bool generateJson(ref Modules modules, ErrorSink eSink)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is forward declared in LDC, but unused, and not in a header.
fyi @ibuclaw

Does this still need to be extern(C++)?

{
OutBuffer buf;
json_generate(modules, buf);
Expand All @@ -144,8 +152,8 @@ extern (C++) void generateJson(ref Modules modules)
{
if (global.params.objfiles.length == 0)
{
error(Loc.initial, "cannot determine JSON filename, use `-Xf=<file>` or provide a source file");
fatal();
eSink.error(Loc.initial, "cannot determine JSON filename, use `-Xf=<file>` or provide a source file");
return true;
}
// Generate json file name from first obj name
const(char)[] n = global.params.objfiles[0].toDString;
Expand All @@ -155,8 +163,9 @@ extern (C++) void generateJson(ref Modules modules)
jsonfilename = FileName.forceExt(n, json_ext);
}
if (!writeFile(Loc.initial, jsonfilename, buf[]))
fatal();
return true;
}
return false;
}

version (DigitalMars)
Expand Down Expand Up @@ -1579,7 +1588,7 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param

// @@@DEPRECATED_2.111@@@
// Deprecated in 2.101, remove in 2.111
deprecation(Loc.initial, "`-version=number` is deprecated, use version identifiers instead");
eSink.deprecation(Loc.initial, "`-version=number` is deprecated, use version identifiers instead");
}
else if (Identifier.isValidIdentifier(p + 9))
{
Expand Down
Loading