- enhancement: add compiler commandline argument for "-E" (only preprocessing)

- enhancement: auto set output suffix to ".expanded.cpp" when compiler commandline argument for "-E" is turned on
  - enhancement: auto set output suffix to ".s" when compiler commandline argument for "-S" is turned on
This commit is contained in:
Roy Qu 2022-05-14 16:43:59 +08:00
parent f412eedcb0
commit a3946b6015
7 changed files with 444 additions and 447 deletions

View File

@ -2,6 +2,9 @@ Red Panda C++ Version 1.0.8
- enhancement: auto complete '#undef' - enhancement: auto complete '#undef'
- enhancement: redesign components for compiler commandline arguments processing - enhancement: redesign components for compiler commandline arguments processing
- fix: selection calculation error when editing in column mode - fix: selection calculation error when editing in column mode
- enhancement: add compiler commandline argument for "-E" (only preprocessing)
- enhancement: auto set output suffix to ".expanded.cpp" when compiler commandline argument for "-E" is turned on
- enhancement: auto set output suffix to ".s" when compiler commandline argument for "-S" is turned on
Red Panda C++ Version 1.0.7 Red Panda C++ Version 1.0.7
- change: use Shift+Enter to break line - change: use Shift+Enter to break line

View File

@ -4825,14 +4825,6 @@
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Tab 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tab 2</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Base compiler set:</source> <source>Base compiler set:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5713,14 +5705,6 @@
<source>C++ Includes</source> <source>C++ Includes</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>All files</source> <source>All files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5773,6 +5757,14 @@
<source>Can&apos;t parse problem set file &apos;%1&apos;:%2</source> <source>Can&apos;t parse problem set file &apos;%1&apos;:%2</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>This CPU</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do not compile, stop after the preprocessing stage (-E)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RegisterModel</name> <name>RegisterModel</name>

File diff suppressed because it is too large Load Diff

View File

@ -4825,14 +4825,6 @@
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Tab 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tab 2</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Base compiler set:</source> <source>Base compiler set:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5713,14 +5705,6 @@
<source>C++ Includes</source> <source>C++ Includes</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>All files</source> <source>All files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5773,6 +5757,14 @@
<source>Can&apos;t parse problem set file &apos;%1&apos;:%2</source> <source>Can&apos;t parse problem set file &apos;%1&apos;:%2</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>This CPU</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do not compile, stop after the preprocessing stage (-E)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RegisterModel</name> <name>RegisterModel</name>

View File

@ -57,6 +57,7 @@ void CompilerInfo::prepareCompilerOptions()
// Optimization for cpu type // Optimization for cpu type
groupName = QObject::tr("Code Generation"); groupName = QObject::tr("Code Generation");
addOption(CC_CMD_OPT_DEBUG_INFO, QObject::tr("Generate debugging information (-g3)"), groupName, true, true, false, "-g3");
QList<QPair<QString,QString>> sl; QList<QPair<QString,QString>> sl;
sl.append(QPair<QString,QString>(QObject::tr("This CPU"),"native")); sl.append(QPair<QString,QString>(QObject::tr("This CPU"),"native"));
sl.append(QPair<QString,QString>("i386","i386")); sl.append(QPair<QString,QString>("i386","i386"));
@ -158,20 +159,19 @@ void CompilerInfo::prepareCompilerOptions()
groupName = QObject::tr("Profile"); groupName = QObject::tr("Profile");
addOption(CC_CMD_OPT_PROFILE_INFO, QObject::tr("Generate profiling info for analysis (-pg)"), groupName, true, true, true, "-pg"); addOption(CC_CMD_OPT_PROFILE_INFO, QObject::tr("Generate profiling info for analysis (-pg)"), groupName, true, true, true, "-pg");
// Output
groupName = QObject::tr("Output");
addOption(CC_CMD_OPT_VERBOSE_ASM, QObject::tr("Put comments in generated assembly code (-fverbose-asm)"), groupName, true, true, false, "-fverbose-asm");
addOption(CC_CMD_OPT_ONLY_GEN_ASM_CODE, QObject::tr("Do not assemble, compile and generate the assemble code (-S)"), groupName, true, true, false, "-S");
addOption(CC_CMD_OPT_STOP_AFTER_PREPROCESSING, QObject::tr("Do not compile, stop after the preprocessing stage (-E)"), groupName, true, true, false, "-E");
addOption(CC_CMD_OPT_USE_PIPE, QObject::tr("Use pipes instead of temporary files during compilation (-pipe)"), groupName, true, true, false, "-pipe");
// Linker // Linker
groupName = QObject::tr("Linker"); groupName = QObject::tr("Linker");
addOption(LINK_CMD_OPT_LINK_OBJC, QObject::tr("Link an Objective C program (-lobjc)"), groupName, false, false, true, "-lobjc"); addOption(LINK_CMD_OPT_LINK_OBJC, QObject::tr("Link an Objective C program (-lobjc)"), groupName, false, false, true, "-lobjc");
addOption(LINK_CMD_OPT_NO_LINK_STDLIB,QObject::tr("Do not use standard system libraries (-nostdlib)"), groupName, false, false, true, "-nostdlib"); addOption(LINK_CMD_OPT_NO_LINK_STDLIB,QObject::tr("Do not use standard system libraries (-nostdlib)"), groupName, false, false, true, "-nostdlib");
addOption(LINK_CMD_OPT_NO_CONSOLE, QObject::tr("Do not create a console window (-mwindows)"), groupName,false, false, true, "-mwindows"); addOption(LINK_CMD_OPT_NO_CONSOLE, QObject::tr("Do not create a console window (-mwindows)"), groupName,false, false, true, "-mwindows");
addOption(LINK_CMD_OPT_STRIP_EXE, QObject::tr("Strip executable (-s)"), groupName, false, false, true, "-s"); addOption(LINK_CMD_OPT_STRIP_EXE, QObject::tr("Strip executable (-s)"), groupName, false, false, true, "-s");
addOption(CC_CMD_OPT_DEBUG_INFO, QObject::tr("Generate debugging information (-g3)"), groupName, true, true, false, "-g3");
// Output
groupName = QObject::tr("Output");
addOption(CC_CMD_OPT_VERBOSE_ASM, QObject::tr("Put comments in generated assembly code (-fverbose-asm)"), groupName, true, true, false, "-fverbose-asm");
addOption(CC_CMD_OPT_ONLY_GEN_ASM_CODE, QObject::tr("Do not assemble, compile and generate the assemble code (-S)"), groupName, true, true, false, "-S");
addOption(CC_CMD_OPT_USE_PIPE, QObject::tr("Use pipes instead of temporary files during compilation (-pipe)"), groupName, true, true, false, "-pipe");
} }
CompilerInfoManager::CompilerInfoManager() CompilerInfoManager::CompilerInfoManager()

View File

@ -37,6 +37,7 @@
#define CC_CMD_OPT_VERBOSE_ASM "cc_cmd_opt_verbose_asm" #define CC_CMD_OPT_VERBOSE_ASM "cc_cmd_opt_verbose_asm"
#define CC_CMD_OPT_ONLY_GEN_ASM_CODE "cc_cmd_opt_only_gen_asm_code" #define CC_CMD_OPT_ONLY_GEN_ASM_CODE "cc_cmd_opt_only_gen_asm_code"
#define CC_CMD_OPT_STOP_AFTER_PREPROCESSING "cc_cmd_opt_stop_after_preprocessing"
#define CC_CMD_OPT_USE_PIPE "cc_cmd_opt_use_pipe" #define CC_CMD_OPT_USE_PIPE "cc_cmd_opt_use_pipe"
#define COMPILER_OPTION_ON "on" #define COMPILER_OPTION_ON "on"

View File

@ -41,7 +41,12 @@ bool FileCompiler::prepareForCompile()
FileType fileType = getFileType(mFilename); FileType fileType = getFileType(mFilename);
mArguments= QString(" \"%1\"").arg(mFilename); mArguments= QString(" \"%1\"").arg(mFilename);
if (!mOnlyCheckSyntax) { if (!mOnlyCheckSyntax) {
mOutputFile = getCompiledExecutableName(mFilename); if (compilerSet()->getCompileOptionValue(CC_CMD_OPT_STOP_AFTER_PREPROCESSING)==COMPILER_OPTION_ON)
mOutputFile=changeFileExt(mFilename,"expanded.cpp");
else if (compilerSet()->getCompileOptionValue(CC_CMD_OPT_ONLY_GEN_ASM_CODE)==COMPILER_OPTION_ON)
mOutputFile=changeFileExt(mFilename,"s");
else
mOutputFile = getCompiledExecutableName(mFilename);
mArguments+=QString(" -o \"%1\"").arg(mOutputFile); mArguments+=QString(" -o \"%1\"").arg(mOutputFile);
//remove the old file if it exists //remove the old file if it exists