- fix: Filename in the gcc 13.1 error messages when building project is using wrong encoding.
This commit is contained in:
parent
f111433ac5
commit
dfbdf604fb
2
NEWS.md
2
NEWS.md
|
@ -17,7 +17,7 @@ Red Panda C++ Version 2.24
|
||||||
- fix: Accessibilty for inherited members are not correct calculated in multiple inheritance.
|
- fix: Accessibilty for inherited members are not correct calculated in multiple inheritance.
|
||||||
- fix: Can't parse full class name when handle inheritance.
|
- fix: Can't parse full class name when handle inheritance.
|
||||||
- fix: Can't parse virtual inherit.
|
- fix: Can't parse virtual inherit.
|
||||||
|
- fix: Filename in the gcc 13.1 error messages when building project is using wrong encoding.
|
||||||
|
|
||||||
Red Panda C++ Version 2.23
|
Red Panda C++ Version 2.23
|
||||||
|
|
||||||
|
|
|
@ -664,6 +664,8 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
|
||||||
bool errorOccurred = false;
|
bool errorOccurred = false;
|
||||||
process.setProgram(cmd);
|
process.setProgram(cmd);
|
||||||
QString cmdDir = extractFileDir(cmd);
|
QString cmdDir = extractFileDir(cmd);
|
||||||
|
bool compilerErrorUTF8=compilerSet()->isCompilerInfoUsingUTF8();
|
||||||
|
bool outputUTF8=compilerSet()->forceUTF8();
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
if (!cmdDir.isEmpty()) {
|
if (!cmdDir.isEmpty()) {
|
||||||
QString path = env.value("PATH");
|
QString path = env.value("PATH");
|
||||||
|
@ -682,18 +684,19 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
|
||||||
process.setArguments(splitProcessCommand(arguments));
|
process.setArguments(splitProcessCommand(arguments));
|
||||||
process.setWorkingDirectory(workingDir);
|
process.setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
|
|
||||||
process.connect(&process, &QProcess::errorOccurred,
|
process.connect(&process, &QProcess::errorOccurred,
|
||||||
[&](){
|
[&](){
|
||||||
errorOccurred= true;
|
errorOccurred= true;
|
||||||
});
|
});
|
||||||
process.connect(&process, &QProcess::readyReadStandardError,[&process,this](){
|
process.connect(&process, &QProcess::readyReadStandardError,[&process,this,compilerErrorUTF8](){
|
||||||
if (compilerSet()->compilerType() == CompilerType::Clang)
|
if (compilerErrorUTF8)
|
||||||
this->error(QString::fromUtf8(process.readAllStandardError()));
|
this->error(QString::fromUtf8(process.readAllStandardError()));
|
||||||
else
|
else
|
||||||
this->error(QString::fromLocal8Bit( process.readAllStandardError()));
|
this->error(QString::fromLocal8Bit( process.readAllStandardError()));
|
||||||
});
|
});
|
||||||
process.connect(&process, &QProcess::readyReadStandardOutput,[&process,this](){
|
process.connect(&process, &QProcess::readyReadStandardOutput,[&process,this,outputUTF8](){
|
||||||
if (compilerSet()->compilerType() == CompilerType::Clang)
|
if (outputUTF8)
|
||||||
this->log(QString::fromUtf8(process.readAllStandardOutput()));
|
this->log(QString::fromUtf8(process.readAllStandardOutput()));
|
||||||
else
|
else
|
||||||
this->log(QString::fromLocal8Bit( process.readAllStandardOutput()));
|
this->log(QString::fromLocal8Bit( process.readAllStandardOutput()));
|
||||||
|
|
|
@ -84,28 +84,8 @@ bool Debugger::start(int compilerSetIndex, const QString& inferior, const QStrin
|
||||||
tr("No compiler set is configured.")+tr("Can't start debugging."));
|
tr("No compiler set is configured.")+tr("Can't start debugging."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setForceUTF8(CompilerInfoManager::forceUTF8InDebugger(compilerSet->compilerType()));
|
setForceUTF8(compilerSet->forceUTF8());
|
||||||
setDebugInfosUsingUTF8(false);
|
setDebugInfosUsingUTF8(compilerSet->isDebugInfoUsingUTF8());
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
|
|
||||||
bool isOk;
|
|
||||||
int productVersion = QSysInfo::productVersion().toInt(&isOk);
|
|
||||||
// qDebug()<<productVersion<<isOk;
|
|
||||||
if (!isOk) {
|
|
||||||
if (QSysInfo::productVersion().startsWith("7"))
|
|
||||||
productVersion=7;
|
|
||||||
else if (QSysInfo::productVersion().startsWith("10"))
|
|
||||||
productVersion=10;
|
|
||||||
else if (QSysInfo::productVersion().startsWith("11"))
|
|
||||||
productVersion=11;
|
|
||||||
else
|
|
||||||
productVersion=10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compilerSet->mainVersion()>=13 && compilerSet->compilerType()==CompilerType::GCC
|
|
||||||
&& productVersion>=10)
|
|
||||||
setDebugInfosUsingUTF8(true);
|
|
||||||
#endif
|
|
||||||
if (compilerSet->debugger().endsWith(LLDB_MI_PROGRAM))
|
if (compilerSet->debugger().endsWith(LLDB_MI_PROGRAM))
|
||||||
setDebuggerType(DebuggerType::LLDB_MI);
|
setDebuggerType(DebuggerType::LLDB_MI);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1794,7 +1794,7 @@ void Settings::CompilerSet::setCompileOptions(const QMap<QString, QString> optio
|
||||||
mCompileOptions=options;
|
mCompileOptions=options;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::CompilerSet::getCompileOptionValue(const QString &key)
|
QString Settings::CompilerSet::getCompileOptionValue(const QString &key) const
|
||||||
{
|
{
|
||||||
return mCompileOptions.value(key,QString());
|
return mCompileOptions.value(key,QString());
|
||||||
}
|
}
|
||||||
|
@ -2485,7 +2485,7 @@ void Settings::CompilerSet::setDirectories(const QString& binDir,CompilerType co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Settings::CompilerSet::mainVersion()
|
int Settings::CompilerSet::mainVersion() const
|
||||||
{
|
{
|
||||||
int i = mVersion.indexOf('.');
|
int i = mVersion.indexOf('.');
|
||||||
if (i<0)
|
if (i<0)
|
||||||
|
@ -2498,22 +2498,22 @@ int Settings::CompilerSet::mainVersion()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::CompilerSet::canCompileC()
|
bool Settings::CompilerSet::canCompileC() const
|
||||||
{
|
{
|
||||||
return fileExists(mCCompiler);
|
return fileExists(mCCompiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::CompilerSet::canCompileCPP()
|
bool Settings::CompilerSet::canCompileCPP() const
|
||||||
{
|
{
|
||||||
return fileExists(mCppCompiler);
|
return fileExists(mCppCompiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::CompilerSet::canMake()
|
bool Settings::CompilerSet::canMake() const
|
||||||
{
|
{
|
||||||
return fileExists(mMake);
|
return fileExists(mMake);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::CompilerSet::canDebug()
|
bool Settings::CompilerSet::canDebug() const
|
||||||
{
|
{
|
||||||
return fileExists(mDebugger);
|
return fileExists(mDebugger);
|
||||||
}
|
}
|
||||||
|
@ -2603,6 +2603,49 @@ bool Settings::CompilerSet::isOutputExecutable(CompilationStage stage)
|
||||||
return stage == CompilationStage::GenerateExecutable;
|
return stage == CompilationStage::GenerateExecutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::CompilerSet::isDebugInfoUsingUTF8() const
|
||||||
|
{
|
||||||
|
switch(mCompilerType) {
|
||||||
|
case CompilerType::Clang:
|
||||||
|
case CompilerType::GCC_UTF8:
|
||||||
|
return true;
|
||||||
|
case CompilerType::GCC:
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (mainVersion()>=13) {
|
||||||
|
bool isOk;
|
||||||
|
int productVersion = QSysInfo::productVersion().toInt(&isOk);
|
||||||
|
// qDebug()<<productVersion<<isOk;
|
||||||
|
if (!isOk) {
|
||||||
|
if (QSysInfo::productVersion().startsWith("7"))
|
||||||
|
productVersion=7;
|
||||||
|
else if (QSysInfo::productVersion().startsWith("10"))
|
||||||
|
productVersion=10;
|
||||||
|
else if (QSysInfo::productVersion().startsWith("11"))
|
||||||
|
productVersion=11;
|
||||||
|
else
|
||||||
|
productVersion=10;
|
||||||
|
}
|
||||||
|
return productVersion>=10;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::CompilerSet::forceUTF8() const
|
||||||
|
{
|
||||||
|
return CompilerInfoManager::forceUTF8InDebugger(mCompilerType);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::CompilerSet::isCompilerInfoUsingUTF8() const
|
||||||
|
{
|
||||||
|
return isDebugInfoUsingUTF8();
|
||||||
|
}
|
||||||
|
|
||||||
const QString &Settings::CompilerSet::assemblingSuffix() const
|
const QString &Settings::CompilerSet::assemblingSuffix() const
|
||||||
{
|
{
|
||||||
return mAssemblingSuffix;
|
return mAssemblingSuffix;
|
||||||
|
|
|
@ -1342,14 +1342,14 @@ public:
|
||||||
void unsetCompileOption(const QString& key);
|
void unsetCompileOption(const QString& key);
|
||||||
void setCompileOptions(const QMap<QString, QString> options);
|
void setCompileOptions(const QMap<QString, QString> options);
|
||||||
|
|
||||||
QString getCompileOptionValue(const QString& key);
|
QString getCompileOptionValue(const QString& key) const;
|
||||||
|
|
||||||
int mainVersion();
|
int mainVersion() const;
|
||||||
|
|
||||||
bool canCompileC();
|
bool canCompileC() const;
|
||||||
bool canCompileCPP();
|
bool canCompileCPP() const;
|
||||||
bool canMake();
|
bool canMake() const;
|
||||||
bool canDebug();
|
bool canDebug() const;
|
||||||
// bool dirsValid(QString& msg);
|
// bool dirsValid(QString& msg);
|
||||||
// bool validateExes(QString& msg);
|
// bool validateExes(QString& msg);
|
||||||
//properties
|
//properties
|
||||||
|
@ -1435,6 +1435,10 @@ public:
|
||||||
bool isOutputExecutable();
|
bool isOutputExecutable();
|
||||||
bool isOutputExecutable(Settings::CompilerSet::CompilationStage stage);
|
bool isOutputExecutable(Settings::CompilerSet::CompilationStage stage);
|
||||||
|
|
||||||
|
bool isDebugInfoUsingUTF8() const;
|
||||||
|
bool forceUTF8() const;
|
||||||
|
bool isCompilerInfoUsingUTF8() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setDirectories(const QString& binDir, CompilerType mCompilerType);
|
void setDirectories(const QString& binDir, CompilerType mCompilerType);
|
||||||
//load hard defines
|
//load hard defines
|
||||||
|
|
Loading…
Reference in New Issue