auto remove a.exe generated by tcc
This commit is contained in:
parent
151e5a6edc
commit
0af113e2a1
1
NEWS.md
1
NEWS.md
|
@ -6,7 +6,6 @@ Red Panda C++ Version 2.7
|
|||
- enhancement: "Trim trailing spaces" in code menu
|
||||
- change: Don't auto disable compile and debug buttons for compiler sets that don't have compiler/debugger programs.
|
||||
- enhancement: Better error messages for missing compile/debug/make programs.
|
||||
- enhancement: "Show special chars" in options / editor / font
|
||||
- fix: Lost compiler set settings if a compiler set's bin dirs is empty.
|
||||
- enhancement: Better error message when trying to debug with Release compile set.
|
||||
- enhancement: Add missing space char color settings in color schemes
|
||||
|
|
|
@ -48,7 +48,7 @@ void Compiler::run()
|
|||
{
|
||||
emit compileStarted();
|
||||
auto action = finally([this]{
|
||||
emit compileFinished();
|
||||
emit compileFinished(mFilename);
|
||||
});
|
||||
try {
|
||||
if (!prepareForCompile()){
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
signals:
|
||||
void compileStarted();
|
||||
void compileFinished();
|
||||
void compileFinished(QString filename);
|
||||
void compileOutput(const QString& msg);
|
||||
void compileIssue(PCompileIssue issue);
|
||||
void compileErrorOccured(const QString& reason);
|
||||
|
|
|
@ -185,6 +185,18 @@ CompilerInfoManager::CompilerInfoManager()
|
|||
mInfos.insert(CompilerType::GCC_UTF8, std::make_shared<GCCUTF8CompilerInfo>());
|
||||
}
|
||||
|
||||
bool CompilerInfoManager::supportSyntaxCheck(CompilerType compilerType)
|
||||
{
|
||||
switch(compilerType) {
|
||||
case CompilerType::GCC:
|
||||
case CompilerType::GCC_UTF8:
|
||||
case CompilerType::Clang:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PCompilerInfo CompilerInfoManager::getInfo(CompilerType compilerType)
|
||||
{
|
||||
return getInstance()->mInfos.value(compilerType,PCompilerInfo());
|
||||
|
|
|
@ -113,6 +113,7 @@ using PCompilerInfoManager = std::shared_ptr<CompilerInfoManager>;
|
|||
class CompilerInfoManager {
|
||||
public:
|
||||
CompilerInfoManager();
|
||||
static bool supportSyntaxCheck(CompilerType compilerType);
|
||||
static PCompilerInfo getInfo(CompilerType compilerType);
|
||||
static bool hasCompilerOption(CompilerType compilerType, const QString& optKey);
|
||||
static PCompilerOption getCompilerOption(CompilerType compilerType, const QString& optKey);
|
||||
|
|
|
@ -205,8 +205,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QByteArray& enc
|
|||
mSyntaxCheckIssueCount = 0;
|
||||
|
||||
//deleted when thread finished
|
||||
StdinCompiler *pStdinCompiler = new StdinCompiler(filename,encoding, content,true,true);
|
||||
mBackgroundSyntaxChecker = pStdinCompiler;
|
||||
mBackgroundSyntaxChecker = new StdinCompiler(filename,encoding, content,true,true);
|
||||
mBackgroundSyntaxChecker->setProject(project);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::finished, mBackgroundSyntaxChecker, &QThread::deleteLater);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
||||
|
@ -405,11 +404,11 @@ bool CompilerManager::canCompile(const QString &)
|
|||
return !compiling();
|
||||
}
|
||||
|
||||
void CompilerManager::onCompileFinished()
|
||||
void CompilerManager::onCompileFinished(QString filename)
|
||||
{
|
||||
QMutexLocker locker(&mCompileMutex);
|
||||
mCompiler=nullptr;
|
||||
pMainWindow->onCompileFinished(false);
|
||||
pMainWindow->onCompileFinished(filename,false);
|
||||
}
|
||||
|
||||
void CompilerManager::onRunnerTerminated()
|
||||
|
@ -435,11 +434,11 @@ void CompilerManager::onCompileIssue(PCompileIssue issue)
|
|||
mCompileIssueCount++;
|
||||
}
|
||||
|
||||
void CompilerManager::onSyntaxCheckFinished()
|
||||
void CompilerManager::onSyntaxCheckFinished(QString filename)
|
||||
{
|
||||
QMutexLocker locker(&mBackgroundSyntaxCheckMutex);
|
||||
mBackgroundSyntaxChecker=nullptr;
|
||||
pMainWindow->onCompileFinished(true);
|
||||
pMainWindow->onCompileFinished(filename, true);
|
||||
}
|
||||
|
||||
void CompilerManager::onSyntaxCheckIssue(PCompileIssue issue)
|
||||
|
|
|
@ -79,9 +79,9 @@ private slots:
|
|||
);
|
||||
void onRunnerTerminated();
|
||||
void onRunnerPausing();
|
||||
void onCompileFinished();
|
||||
void onCompileFinished(QString filename);
|
||||
void onCompileIssue(PCompileIssue issue);
|
||||
void onSyntaxCheckFinished();
|
||||
void onSyntaxCheckFinished(QString filename);
|
||||
void onSyntaxCheckIssue(PCompileIssue issue);
|
||||
|
||||
private:
|
||||
|
|
|
@ -54,7 +54,11 @@ bool FileCompiler::prepareForCompile()
|
|||
stage = oldStage;
|
||||
}
|
||||
compilerSet()->setCompilationStage(stage);
|
||||
log(tr("Compiling single file..."));
|
||||
if (mOnlyCheckSyntax) {
|
||||
log(tr("Checking single file..."));
|
||||
} else {
|
||||
log(tr("Compiling single file..."));
|
||||
}
|
||||
log("------------------");
|
||||
log(tr("- Filename: %1").arg(mFilename));
|
||||
log(tr("- Compiler Set Name: %1").arg(compilerSet()->name()));
|
||||
|
|
|
@ -5423,7 +5423,7 @@ void MainWindow::onCompileStarted()
|
|||
//do nothing
|
||||
}
|
||||
|
||||
void MainWindow::onCompileFinished(bool isCheckSyntax)
|
||||
void MainWindow::onCompileFinished(QString filename, bool isCheckSyntax)
|
||||
{
|
||||
if (mQuitting) {
|
||||
if (isCheckSyntax)
|
||||
|
@ -5453,6 +5453,11 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
|
|||
}
|
||||
|
||||
if (isCheckSyntax) {
|
||||
if (!CompilerInfoManager::supportSyntaxCheck(pSettings->compilerSets().defaultSet()->compilerType())) {
|
||||
QDir dir(extractFileDir(filename));
|
||||
QFile::remove(dir.absoluteFilePath("a.exe"));
|
||||
}
|
||||
|
||||
// check syntax in back, don't change message panel
|
||||
} else if (ui->tableIssues->count() == 0) {
|
||||
// Close it if there's nothing to show
|
||||
|
|
|
@ -224,7 +224,7 @@ public slots:
|
|||
void clearToolsOutput();
|
||||
void clearTodos();
|
||||
void onCompileStarted();
|
||||
void onCompileFinished(bool isCheckSyntax);
|
||||
void onCompileFinished(QString filename, bool isCheckSyntax);
|
||||
void onCompileErrorOccured(const QString& reason);
|
||||
void onRunErrorOccured(const QString& reason);
|
||||
void onRunFinished();
|
||||
|
|
Loading…
Reference in New Issue