diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index f5518f60..5b3c7110 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -36,9 +36,8 @@ #define COMPILE_PROCESS_END "---//END//----" -Compiler::Compiler(const QString &filename, bool silent, bool onlyCheckSyntax): +Compiler::Compiler(const QString &filename, bool onlyCheckSyntax): QThread(), - mSilent(silent), mOnlyCheckSyntax(onlyCheckSyntax), mFilename(filename), mRebuild(false), diff --git a/RedPandaIDE/compiler/compiler.h b/RedPandaIDE/compiler/compiler.h index 326f23ce..eec997ab 100644 --- a/RedPandaIDE/compiler/compiler.h +++ b/RedPandaIDE/compiler/compiler.h @@ -34,7 +34,7 @@ public: Project, StdIn }; - Compiler(const QString& filename, bool silent,bool onlyCheckSyntax); + Compiler(const QString& filename, bool onlyCheckSyntax); Compiler(const Compiler&)=delete; Compiler& operator=(const Compiler&)=delete; @@ -88,7 +88,6 @@ protected: void runCommand(const QString& cmd, const QString& arguments, const QString& workingDir, const QByteArray& inputText=QByteArray(), const QString& outputFile=QString()); protected: - bool mSilent; bool mOnlyCheckSyntax; QString mCompiler; QString mArguments; diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index aa7b5475..ce4af2e4 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -92,10 +92,10 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin //deleted when thread finished #ifdef ENABLE_SDCC if (pSettings->compilerSets().defaultSet()->compilerType()==CompilerType::SDCC) { - mCompiler = new SDCCFileCompiler(filename,encoding,compileType); + mCompiler = new SDCCFileCompiler(filename,encoding,compileType,false); } else #endif - mCompiler = new FileCompiler(filename,encoding,compileType,false,false); + mCompiler = new FileCompiler(filename,encoding,compileType,false); mCompiler->setRebuild(rebuild); connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater); connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished); @@ -126,7 +126,7 @@ void CompilerManager::compileProject(std::shared_ptr project, bool rebu mCompileErrorCount = 0; mCompileIssueCount = 0; //deleted when thread finished - mCompiler = new ProjectCompiler(project,false,false); + mCompiler = new ProjectCompiler(project,false); mCompiler->setRebuild(rebuild); connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater); connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished); @@ -158,7 +158,7 @@ void CompilerManager::cleanProject(std::shared_ptr project) mCompileErrorCount = 0; mCompileIssueCount = 0; //deleted when thread finished - ProjectCompiler* compiler = new ProjectCompiler(project,false,false); + ProjectCompiler* compiler = new ProjectCompiler(project,false); compiler->setOnlyClean(true); mCompiler = compiler; mCompiler->setRebuild(false); @@ -189,7 +189,7 @@ void CompilerManager::buildProjectMakefile(std::shared_ptr project) if (mCompiler!=nullptr) { return; } - ProjectCompiler compiler(project,false,false); + ProjectCompiler compiler(project,false); compiler.buildMakeFile(); } @@ -213,7 +213,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QByteArray& enc mSyntaxCheckIssueCount = 0; //deleted when thread finished - mBackgroundSyntaxChecker = new StdinCompiler(filename,encoding, content,true,true); + mBackgroundSyntaxChecker = new StdinCompiler(filename,encoding, content,true); mBackgroundSyntaxChecker->setProject(project); connect(mBackgroundSyntaxChecker, &Compiler::finished, mBackgroundSyntaxChecker, &QThread::deleteLater); connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue); diff --git a/RedPandaIDE/compiler/compilermanager.h b/RedPandaIDE/compiler/compilermanager.h index 85b8d04a..1a7ee2cf 100644 --- a/RedPandaIDE/compiler/compilermanager.h +++ b/RedPandaIDE/compiler/compilermanager.h @@ -19,7 +19,6 @@ #include #include -#include "../utils.h" #include "../common.h" class Runner; diff --git a/RedPandaIDE/compiler/filecompiler.cpp b/RedPandaIDE/compiler/filecompiler.cpp index 477c2439..e15632aa 100644 --- a/RedPandaIDE/compiler/filecompiler.cpp +++ b/RedPandaIDE/compiler/filecompiler.cpp @@ -16,7 +16,6 @@ */ #include "filecompiler.h" #include "utils.h" -#include "../mainwindow.h" #include "compilermanager.h" #include "qsynedit/syntaxer/asm.h" #include "../systemconsts.h" @@ -27,8 +26,8 @@ FileCompiler::FileCompiler(const QString &filename, const QByteArray &encoding, - CppCompileType compileType,bool silent,bool onlyCheckSyntax): - Compiler(filename, silent,onlyCheckSyntax), + CppCompileType compileType, bool onlyCheckSyntax): + Compiler(filename, onlyCheckSyntax), mEncoding(encoding), mCompileType(compileType) { diff --git a/RedPandaIDE/compiler/filecompiler.h b/RedPandaIDE/compiler/filecompiler.h index 731a09bf..504b5771 100644 --- a/RedPandaIDE/compiler/filecompiler.h +++ b/RedPandaIDE/compiler/filecompiler.h @@ -25,7 +25,7 @@ class FileCompiler : public Compiler public: FileCompiler(const QString& filename, const QByteArray& encoding, CppCompileType compileType, - bool silent,bool onlyCheckSyntax); + bool onlyCheckSyntax); FileCompiler(const FileCompiler&)=delete; FileCompiler& operator=(const FileCompiler&)=delete; diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index a2c3c3a3..bc43bf2e 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -23,8 +23,8 @@ #include -ProjectCompiler::ProjectCompiler(std::shared_ptr project, bool silent, bool onlyCheckSyntax): - Compiler("",silent,onlyCheckSyntax), +ProjectCompiler::ProjectCompiler(std::shared_ptr project, bool onlyCheckSyntax): + Compiler("",onlyCheckSyntax), mOnlyClean(false) { setProject(project); diff --git a/RedPandaIDE/compiler/projectcompiler.h b/RedPandaIDE/compiler/projectcompiler.h index 0ad76d07..20406c32 100644 --- a/RedPandaIDE/compiler/projectcompiler.h +++ b/RedPandaIDE/compiler/projectcompiler.h @@ -26,7 +26,7 @@ class ProjectCompiler : public Compiler { Q_OBJECT public: - ProjectCompiler(std::shared_ptr project, bool silent,bool onlyCheckSyntax); + ProjectCompiler(std::shared_ptr project, bool onlyCheckSyntax); ProjectCompiler(const ProjectCompiler&)=delete; ProjectCompiler& operator=(const ProjectCompiler&)=delete; void buildMakeFile(); diff --git a/RedPandaIDE/compiler/sdccfilecompiler.cpp b/RedPandaIDE/compiler/sdccfilecompiler.cpp index e16d9a9a..cec0c795 100644 --- a/RedPandaIDE/compiler/sdccfilecompiler.cpp +++ b/RedPandaIDE/compiler/sdccfilecompiler.cpp @@ -25,8 +25,8 @@ SDCCFileCompiler::SDCCFileCompiler(const QString &filename, const QByteArray &encoding, - CppCompileType compileType): - Compiler(filename, false,false), + CppCompileType compileType, bool onlyCheckSyntax): + Compiler(filename, onlyCheckSyntax), mEncoding(encoding), mCompileType(compileType), mNoStartup(false) @@ -36,7 +36,17 @@ SDCCFileCompiler::SDCCFileCompiler(const QString &filename, const QByteArray &en bool SDCCFileCompiler::prepareForCompile() { - compilerSet()->setCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable); + //compilerSet()->setCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable); + + if (mOnlyCheckSyntax) { + mCompiler = compilerSet()->CCompiler(); + mArguments += getCCompileArguments(false); + mArguments += getCIncludeArguments(); + mArguments += getProjectIncludeArguments(); + mArguments = QString("--syntax-only \"%1\"").arg(mFilename); + mDirectory = extractFileDir(mFilename); + return true; + } log(tr("Compiling single file...")); log("------------------"); log(tr("- Filename: %1").arg(mFilename)); diff --git a/RedPandaIDE/compiler/sdccfilecompiler.h b/RedPandaIDE/compiler/sdccfilecompiler.h index 8b214d11..70e41d4d 100644 --- a/RedPandaIDE/compiler/sdccfilecompiler.h +++ b/RedPandaIDE/compiler/sdccfilecompiler.h @@ -24,7 +24,7 @@ class SDCCFileCompiler : public Compiler Q_OBJECT public: SDCCFileCompiler(const QString& filename, const QByteArray& encoding, - CppCompileType compileType); + CppCompileType compileType, bool onlyCheckSyntax); SDCCFileCompiler(const SDCCFileCompiler&)=delete; SDCCFileCompiler& operator=(const SDCCFileCompiler&)=delete; diff --git a/RedPandaIDE/compiler/stdincompiler.cpp b/RedPandaIDE/compiler/stdincompiler.cpp index 680743fd..b025eaf3 100644 --- a/RedPandaIDE/compiler/stdincompiler.cpp +++ b/RedPandaIDE/compiler/stdincompiler.cpp @@ -20,8 +20,8 @@ #include #include -StdinCompiler::StdinCompiler(const QString &filename,const QByteArray& encoding, const QString& content,bool silent, bool onlyCheckSyntax): - Compiler(filename,silent, onlyCheckSyntax), +StdinCompiler::StdinCompiler(const QString &filename,const QByteArray& encoding, const QString& content, bool onlyCheckSyntax): + Compiler(filename, onlyCheckSyntax), mContent(content), mEncoding(encoding) { diff --git a/RedPandaIDE/compiler/stdincompiler.h b/RedPandaIDE/compiler/stdincompiler.h index 96860836..e7b615bd 100644 --- a/RedPandaIDE/compiler/stdincompiler.h +++ b/RedPandaIDE/compiler/stdincompiler.h @@ -24,7 +24,7 @@ class StdinCompiler : public Compiler Q_OBJECT public: - explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool silent,bool onlyCheckSyntax); + explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool onlyCheckSyntax); StdinCompiler(const StdinCompiler&)=delete; StdinCompiler& operator=(const StdinCompiler&)=delete; diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 449ef9e8..d68a1443 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -3018,9 +3018,13 @@ bool Settings::CompilerSets::addSets(const QString &folder, const QString& c_pro PCompilerSet baseSet = addSet(folder,c_prog); if (!baseSet || baseSet->name().isEmpty()) return false; +#if ENABLE_SDCC if (c_prog == SDCC_PROGRAM) { - //sdcc do nothing + baseSet->setCompileOption(SDCC_OPT_NOSTARTUP,COMPILER_OPTION_ON); } else { +#else + { +#endif QString baseName = baseSet->name(); QString platformName; if (isTarget64Bit(baseSet->target())) {