- change: continue to run / debug if there are compiling warnings (but no errors)

This commit is contained in:
royqh1979@gmail.com 2021-09-26 22:52:19 +08:00
parent 2915a862ff
commit 4634c0fbbc
4 changed files with 40 additions and 35 deletions

View File

@ -1,4 +1,5 @@
Version 0.2 Version 0.2
- change: continue to run / debug if there are compiling warnings (but no errors)
- enhancement: class browser syntax colors and icons - enhancement: class browser syntax colors and icons
- enhancement: function tips - enhancement: function tips
- enhancement: project support - enhancement: project support

View File

@ -222,9 +222,11 @@ void CompilerManager::onRunnerTerminated()
p->deleteLater(); p->deleteLater();
} }
void CompilerManager::onCompileIssue(PCompileIssue) void CompilerManager::onCompileIssue(PCompileIssue issue)
{ {
mCompileErrorCount ++; if (issue->type == CompileIssueType::Error)
mCompileErrorCount++;
mCompileIssueCount++;
} }
void CompilerManager::onSyntaxCheckFinished() void CompilerManager::onSyntaxCheckFinished()
@ -234,9 +236,22 @@ void CompilerManager::onSyntaxCheckFinished()
mBackgroundSyntaxChecker=nullptr; mBackgroundSyntaxChecker=nullptr;
} }
void CompilerManager::onSyntaxCheckIssue(PCompileIssue) void CompilerManager::onSyntaxCheckIssue(PCompileIssue issue)
{ {
if (issue->type == CompileIssueType::Error)
mSyntaxCheckErrorCount++; mSyntaxCheckErrorCount++;
mSyntaxCheckIssueCount++;
}
int CompilerManager::syntaxCheckIssueCount() const
{
return mSyntaxCheckIssueCount;
}
int CompilerManager::compileIssueCount() const
{
return mCompileIssueCount;
} }
int CompilerManager::syntaxCheckErrorCount() const int CompilerManager::syntaxCheckErrorCount() const

View File

@ -33,6 +33,10 @@ public:
int syntaxCheckErrorCount() const; int syntaxCheckErrorCount() const;
int compileIssueCount() const;
int syntaxCheckIssueCount() const;
private slots: private slots:
void onRunnerTerminated(); void onRunnerTerminated();
void onCompileFinished(); void onCompileFinished();
@ -43,7 +47,9 @@ private slots:
private: private:
Compiler* mCompiler; Compiler* mCompiler;
int mCompileErrorCount; int mCompileErrorCount;
int mCompileIssueCount;
int mSyntaxCheckErrorCount; int mSyntaxCheckErrorCount;
int mSyntaxCheckIssueCount;
Compiler* mBackgroundSyntaxChecker; Compiler* mBackgroundSyntaxChecker;
ExecutableRunner* mRunner; ExecutableRunner* mRunner;
QMutex mCompileMutex; QMutex mCompileMutex;

View File

@ -293,7 +293,7 @@ void MainWindow::updateCompileActions()
if (e) { if (e) {
FileType fileType = getFileType(e->filename()); FileType fileType = getFileType(e->filename());
if (fileType == FileType::CSource if (fileType == FileType::CSource
|| fileType == FileType::CppSource) || fileType == FileType::CppSource || e->isNew())
editorCanCompile = true; editorCanCompile = true;
} }
if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing() if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()
@ -2428,8 +2428,19 @@ void MainWindow::onCompileFinished()
e->invalidate(); e->invalidate();
} }
//run succession task if there aren't any errors
if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) {
switch (mCompileSuccessionTask->type) {
case MainWindow::CompileSuccessionTaskType::Run:
runExecutable(mCompileSuccessionTask->filename);
break;
case MainWindow::CompileSuccessionTaskType::Debug:
debug();
break;
}
mCompileSuccessionTask.reset();
// Jump to problem location, sorted by significance // Jump to problem location, sorted by significance
if ((mCompilerManager->compileErrorCount() > 0) && (!mCheckSyntaxInBack)) { } else if ((mCompilerManager->compileIssueCount() > 0) && (!mCheckSyntaxInBack)) {
// First try to find errors // First try to find errors
for (int i=0;i<ui->tableIssues->count();i++) { for (int i=0;i<ui->tableIssues->count();i++) {
PCompileIssue issue = ui->tableIssues->issue(i); PCompileIssue issue = ui->tableIssues->issue(i);
@ -2454,34 +2465,6 @@ void MainWindow::onCompileFinished()
emit ui->tableIssues->doubleClicked(index); emit ui->tableIssues->doubleClicked(index);
} }
} }
// Then try to find anything with a line number...
// for I := 0 to CompilerOutput.Items.Count - 1 do begin
// if not SameStr(CompilerOutput.Items[I].Caption, '') then begin
// CompilerOutput.Selected := CompilerOutput.Items[I];
// CompilerOutput.Selected.MakeVisible(False);
// CompilerOutputDblClick(CompilerOutput);
// Exit;
// end;
// end;
// Then try to find a resource error
// if ResourceOutput.Items.Count > 0 then begin
// ResourceOutput.Selected := ResourceOutput.Items[0];
// ResourceOutput.Selected.MakeVisible(False);
// CompilerOutputDblClick(ResourceOutput);
// end;
} else {
if (mCompileSuccessionTask) {
switch (mCompileSuccessionTask->type) {
case MainWindow::CompileSuccessionTaskType::Run:
runExecutable(mCompileSuccessionTask->filename);
break;
case MainWindow::CompileSuccessionTaskType::Debug:
debug();
break;
}
mCompileSuccessionTask.reset();
}
} }
mCheckSyntaxInBack=false; mCheckSyntaxInBack=false;
updateCompileActions(); updateCompileActions();