Improve the error message when the compilation does not produce any files #1390.

This commit is contained in:
Christoffer Lerno
2024-08-28 11:16:39 +02:00
parent 22151a0a03
commit dfe80eb050
2 changed files with 11 additions and 1 deletions

View File

@@ -36,6 +36,7 @@
- Introduce `$vaarg[...]` syntax and deprecate the old `$vaarg(...)`.
- Similar change to `$vasplat`: `$vasplat` and `$vasplat[1..]`.
- Add `$member.get(value)` to replace `value.$eval($member.nameof)`
- Improve the error message when the compilation does not produce any files #1390.
### Fixes

View File

@@ -510,7 +510,16 @@ void compiler_compile(void)
}
if (!output_file_count)
{
error_exit("No output files found.");
if (output_exe)
{
error_exit("No output files were generated. This may happen if the program is not "
"linked with anything and all the code is optimized away.");
}
else
{
error_exit("No output files were generated. This may happen if there were no exported functions "
"and all the other code was optimized away.");
}
}
CompileData *compile_data = ccalloc(sizeof(CompileData), output_file_count);