diff --git a/NEWS.md b/NEWS.md index c0555e60..18811638 100644 --- a/NEWS.md +++ b/NEWS.md @@ -88,6 +88,8 @@ Red Panda C++ Version 2.27 - change: Set focus to "find" button when "find in files..." dialog is openned. - enhancement: Correct tab orders for all setting pages/dialogs. - enhancement: Shortcut key for buttons in find/replace and "find in files" dialogs. + + - enhancement: Auto define macro "_DEBUG" for "Debug" compiler set(like visual studio). Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/compiler/filecompiler.cpp b/RedPandaIDE/compiler/filecompiler.cpp index 0847af81..bf9afd65 100644 --- a/RedPandaIDE/compiler/filecompiler.cpp +++ b/RedPandaIDE/compiler/filecompiler.cpp @@ -138,7 +138,9 @@ bool FileCompiler::prepareForCompile() default: throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename)); } - + if (mArguments.contains("-g3")) { + mArguments << "-D_DEBUG"; + } if (!mOnlyCheckSyntax) mArguments += getLibraryArguments(fileType); diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 88c17bca..f4891244 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -226,8 +226,10 @@ void ProjectCompiler::writeMakeDefines(QFile &file) QStringList cCompileArguments = getCCompileArguments(false); QStringList cxxCompileArguments = getCppCompileArguments(false); if (cCompileArguments.contains("-g3")) { - cCompileArguments << "-D__DEBUG__"; - cxxCompileArguments << "-D__DEBUG__"; + cCompileArguments << "-D_DEBUG"; + } + if (cxxCompileArguments.contains("-g3")) { + cxxCompileArguments << "-D_DEBUG"; } QStringList libraryArguments = getLibraryArguments(FileType::Project); QStringList cIncludeArguments = getCIncludeArguments(); diff --git a/RedPandaIDE/compiler/sdccprojectcompiler.cpp b/RedPandaIDE/compiler/sdccprojectcompiler.cpp index 52cc6b53..d18934a0 100644 --- a/RedPandaIDE/compiler/sdccprojectcompiler.cpp +++ b/RedPandaIDE/compiler/sdccprojectcompiler.cpp @@ -143,7 +143,8 @@ void SDCCProjectCompiler::writeMakeDefines(QFile &file) QStringList cCompileArguments = getCCompileArguments(mOnlyCheckSyntax); if (cCompileArguments.contains("-g3")) - cCompileArguments << "-D__DEBUG__"; + cCompileArguments << "-D_DEBUG"; + QStringList libraryArguments = getLibraryArguments(FileType::Project); QStringList cIncludeArguments = getCIncludeArguments() + getProjectIncludeArguments(); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 429324d9..0a03c8d1 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2510,6 +2510,10 @@ QStringList Settings::CompilerSet::defines(bool isCpp) { if (!mCompileOptions[key].isEmpty()) arguments.append(pOption->setting + mCompileOptions[key]); } + pOption = CompilerInfoManager::getCompilerOption(compilerType(), CC_CMD_OPT_DEBUG_INFO); + if (pOption && mCompileOptions.contains(CC_CMD_OPT_DEBUG_INFO)) { + arguments.append(pOption->setting); + } #ifdef ENABLE_SDCC } #endif @@ -2518,8 +2522,12 @@ QStringList Settings::CompilerSet::defines(bool isCpp) { QStringList extraParams = parseArgumentsWithoutVariables(mCustomCompileParams); arguments.append(extraParams); } + if (arguments.contains("-g3")) + arguments.append("-D_DEBUG"); arguments.append(NULL_FILE); + qDebug()<