Add compiler argument settings
MODIFY
src/ccmanager.cpp
src/ccmanager.cpp
@@ -21,7 +21,7 @@ const static QString s_testprogram = "int main() { return 0; }";
* - %4: input source file
* - %5: output executable
*/
-const static QString s_baseCC = "%1 -march=%2 -mabi=%3 -x c -s %4 -o %5";
+const static QString s_baseCC = "%1 -march=%2 -mabi=%3 %4 -x c -s %5 -o %6";
CCManager::CCManager() {
if (RipesSettings::value(RIPES_SETTING_CCPATH) == "") {
@@ -95,6 +95,9 @@ bool CCManager::verifyCC(const QString& CCPath) {
// Substitute machine ABI
s_cc = s_cc.arg(currentISA->CCmabi());
+ // Substitute additional CC arguments
+ s_cc = s_cc.arg(RipesSettings::value(RIPES_SETTING_CCARGS).toString());
+
// Substitute in and out files
s_cc = s_cc.arg(testSrcFile.fileName()).arg(testSrcFileOut);

MODIFY
src/ripessettings.h
src/ripessettings.h
@@ -7,10 +7,12 @@ namespace Ripes {
// Definitions of the name of all settings within Ripes
#define RIPES_SETTING_REWINDSTACKSIZE ("simulator_rewindstacksize")
#define RIPES_SETTING_CCPATH ("compiler_path")
+#define RIPES_SETTING_CCARGS ("compiler_args")
// Definitions of all default settings within Ripes
const static std::map<QString, QVariant> s_defaultSettings = {{RIPES_SETTING_REWINDSTACKSIZE, 100},
- {RIPES_SETTING_CCPATH, ""}};
+ {RIPES_SETTING_CCPATH, ""},
+ {RIPES_SETTING_CCARGS, "-O3"}};
/**
* @brief The SettingObserver class

MODIFY
src/settingsdialog.cpp
src/settingsdialog.cpp
@@ -111,9 +111,18 @@ QWidget* SettingsDialog::createEditorPage() {
// Trigger initial rehighlighting
CCManager::get().trySetCC(CCManager::get().currentCC());
-
CCHLayout->addWidget(pathBrowseButton);
+ // Add compiler argument widget
+ auto [ccArgLabel, ccArgs] = createSettingsWidgets<QLineEdit>(RIPES_SETTING_CCARGS, "Compiler arguments:");
+ auto* CCArgHLayout = new QHBoxLayout();
+ CCArgHLayout->addWidget(ccArgLabel);
+ CCArgHLayout->addWidget(ccArgs);
+ CCLayout->addLayout(CCArgHLayout);
+ // Make changes in argument reemit ccpath text changed. By doing so, we revalidate the compiler once new arguments
+ // have been added, implicitely validating the arguments along with it.
+ connect(ccArgs, &QLineEdit::textChanged, [=, ccpath = ccpath] { emit ccpath->textChanged(ccpath->text()); });
+
pageLayout->addWidget(CCGroupBox);
return pageWidget;

Add compiler argument settings