added message dumping for -parse option if running from console

This commit is contained in:
ALEXks
2025-06-05 19:04:56 +03:00
parent a96a4bcaa6
commit 623898d913
4 changed files with 58 additions and 51 deletions

View File

@@ -451,13 +451,6 @@ static int dumpErrors(const vector<FileInfo>& listOfProject, const vector<string
continue;
}
FILE* ferr = fopen(file.errPath.c_str(), "w");
FILE* fout = fopen(file.outPath.c_str(), "w");
if (!ferr)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
if (!fout)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
string errS = "", outS = "";
vector<string> splited;
splitString(errors[z], '\n', splited);
@@ -476,13 +469,22 @@ static int dumpErrors(const vector<FileInfo>& listOfProject, const vector<string
}
}
fprintf(fout, "%s", outS.c_str());
fprintf(ferr, "%s", errS.c_str());
FILE* ferr = fopen(file.errPath.c_str(), "w");
FILE* fout = fopen(file.outPath.c_str(), "w");
if (ferr)
{
fprintf(ferr, "%s", errS.c_str());
fclose(ferr);
}
if (fout)
{
fprintf(fout, "%s", outS.c_str());
fclose(fout);
}
fflush(NULL);
fclose(fout);
fclose(ferr);
++z;
}
@@ -810,6 +812,8 @@ void parseFiles(int argc, char** argv)
printf(" run parsing for inlining\n");
int rethrow = parseFiles(errors, listOfProject, filesCompilationOrder, isInline, true);
int errCount = dumpErrors(listOfProject, errors, messages);
if (rethrow == 0)
{
for (auto& err : errors)
@@ -839,5 +843,7 @@ void parseFiles(int argc, char** argv)
}
else
printf("Parsing was completed with errors, throw code %d, errors count %d\n", rethrow, code);
dumpMessages(false, messages, VISUALIZER_DATA_PATH);
exit(0);
}