Apply clang-format to remaining files
MODIFY
examples/C/io.c
examples/C/io.c
@@ -5,7 +5,8 @@ float getf() {
float f;
char c;
while (!scanf("%f", &f)) {
- while ((c = getchar()) != '\n' && c != EOF) { } // Clear input buffer
+ while ((c = getchar()) != '\n' && c != EOF) {
+ } // Clear input buffer
printf("Invalid number, please try again.\n");
}
return f;

MODIFY
src/assembler/rv32i_assembler.cpp
src/assembler/rv32i_assembler.cpp
#include "rv32i_assembler.h"
#include "gnudirectives.h"
-#include "rvrelocations.h"
#include "ripessettings.h"
+#include "rvrelocations.h"
#include <QByteArray>
#include <algorithm>

MODIFY
src/flowlayout.h
src/flowlayout.h
#include <QRect>
#include <QStyle>
//! [0]
-class FlowLayout : public QLayout
-{
+class FlowLayout : public QLayout {
public:
explicit FlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);

MODIFY
src/processors/RISC-V/rv5s/rv5s_idex.h
src/processors/RISC-V/rv5s/rv5s_idex.h
@@ -14,8 +14,8 @@ using namespace Ripes;
/**
* @brief The RV5S_IDEX class
- * A specialization of the default IDEX stage separating register utilized by the rv5s_no_fw_hz processor. Storage of register
- * read indices is added, which are required by the forwarding unit.
+ * A specialization of the default IDEX stage separating register utilized by the rv5s_no_fw_hz processor. Storage of
+ * register read indices is added, which are required by the forwarding unit.
*/
class RV5S_IDEX : public IDEX {
public:

MODIFY
src/processorselectiondialog.cpp
src/processorselectiondialog.cpp
@@ -51,8 +51,7 @@ ProcessorSelectionDialog::ProcessorSelectionDialog(QWidget* parent)
for (const auto& desc : ProcessorRegistry::getAvailableProcessors()) {
m_selectedExtensionsForID[desc.second.id] = desc.second.isa->supportedExtensions();
}
- m_selectedExtensionsForID[ProcessorHandler::getID()] =
- ProcessorHandler::currentISA()->enabledExtensions();
+ m_selectedExtensionsForID[ProcessorHandler::getID()] = ProcessorHandler::currentISA()->enabledExtensions();
if (selectedItem != nullptr) {
// Select the processor and layout which is currently active

MODIFY
src/registermodel.cpp
src/registermodel.cpp
@@ -138,8 +138,7 @@ QVariant RegisterModel::valueData(unsigned idx) const {
}
Qt::ItemFlags RegisterModel::flags(const QModelIndex& index) const {
- const auto def =
- ProcessorHandler::currentISA()->regIsReadOnly(index.row()) ? Qt::NoItemFlags : Qt::ItemIsEnabled;
+ const auto def = ProcessorHandler::currentISA()->regIsReadOnly(index.row()) ? Qt::NoItemFlags : Qt::ItemIsEnabled;
if (index.column() == Column::Value)
return Qt::ItemIsEditable | def;
return def;

MODIFY
src/syscall/control.h
src/syscall/control.h
@@ -29,7 +29,8 @@ class Exit2Syscall : public BaseSyscall {
public:
Exit2Syscall() : BaseSyscall("Exit2", "Exits the program with a code", {{0, "the number to exit with"}}) {}
void execute() {
- SystemIO::printString("\nProgram exited with code: " + QString::number(BaseSyscall::getArg(RegisterFileType::GPR,0)));
+ SystemIO::printString("\nProgram exited with code: " +
+ QString::number(BaseSyscall::getArg(RegisterFileType::GPR, 0)));
FinalizeReason fr;
fr.exitSyscall = true;
ProcessorHandler::getProcessorNonConst()->finalize(fr);

MODIFY
src/syscall/file.h
src/syscall/file.h
@@ -59,7 +59,9 @@ public:
{2, "the base is the begining of the file (0), the current position (1), or the end of the file (2)"}},
{{0, "the selected position from the beginning of the file or -1 if an error occurred"}}) {}
void execute() {
- int result = SystemIO::seek(BaseSyscall::getArg(RegisterFileType::GPR,0), BaseSyscall::getArg(RegisterFileType::GPR,1), BaseSyscall::getArg(RegisterFileType::GPR,2));
+ int result =
+ SystemIO::seek(BaseSyscall::getArg(RegisterFileType::GPR, 0), BaseSyscall::getArg(RegisterFileType::GPR, 1),
+ BaseSyscall::getArg(RegisterFileType::GPR, 2));
BaseSyscall::setRet(RegisterFileType::GPR, 0, result);
}
};
@@ -133,7 +135,8 @@ public:
{{0, "the buffer to write into"}, {1, "the length of the buffer"}},
{{0, "-1 if the path is longer than the buffer"}}) {}
void execute() {
- const int byteAddress = BaseSyscall::getArg(RegisterFileType::GPR,0); // destination of characters read from file
+ const int byteAddress =
+ BaseSyscall::getArg(RegisterFileType::GPR, 0); // destination of characters read from file
int index = 0;
const int bufferSize = BaseSyscall::getArg(RegisterFileType::GPR, 1);

MODIFY
src/syscall/print.h
src/syscall/print.h
@@ -76,8 +76,8 @@ public:
{{0, "integer to print"}}) {}
void execute() {
const uint32_t arg0 = BaseSyscall::getArg(RegisterFileType::GPR, 0);
- SystemIO::printString(
- "0x" + QString::number(arg0, 16).rightJustified(ProcessorHandler::currentISA()->bytes(), '0'));
+ SystemIO::printString("0x" +
+ QString::number(arg0, 16).rightJustified(ProcessorHandler::currentISA()->bytes(), '0'));
}
};
@@ -91,8 +91,8 @@ public:
{{0, "integer to print"}}) {}
void execute() {
const uint32_t arg0 = BaseSyscall::getArg(RegisterFileType::GPR, 0);
- SystemIO::printString(
- "0b" + QString::number(arg0, 2).rightJustified(ProcessorHandler::currentISA()->bits(), '0'));
+ SystemIO::printString("0b" +
+ QString::number(arg0, 2).rightJustified(ProcessorHandler::currentISA()->bits(), '0'));
}
};

MODIFY
src/syscall/ripes_syscall.cpp
src/syscall/ripes_syscall.cpp
@@ -7,12 +7,11 @@ namespace Ripes {
bool SyscallManager::execute(int id) {
if (m_syscalls.count(id) == 0) {
postToGUIThread([=] {
- QMessageBox::warning(nullptr, "Error",
+ QMessageBox::warning(
+ nullptr, "Error",
"Unknown system call in register '" +
- ProcessorHandler::currentISA()->regAlias(
- ProcessorHandler::currentISA()->syscallReg()) +
- "': " + QString::number(id) +
- "\nRefer to \"Help->System calls\" for a list of support system calls.");
+ ProcessorHandler::currentISA()->regAlias(ProcessorHandler::currentISA()->syscallReg()) + "': " +
+ QString::number(id) + "\nRefer to \"Help->System calls\" for a list of support system calls.");
});
return false;
} else {

MODIFY
src/syscall/syscallviewer.cpp
src/syscall/syscallviewer.cpp
@@ -31,8 +31,7 @@ SyscallViewer::SyscallViewer(QWidget* parent) : QDialog(parent), m_ui(new Ui::Sy
m_ui->syscallList->setSelectionBehavior(QAbstractItemView::SelectRows);
m_ui->syscallList->verticalHeader()->hide();
m_ui->syscallList->setHorizontalHeaderLabels(
- {"Func. (" +
- ProcessorHandler::currentISA()->regAlias(ProcessorHandler::currentISA()->syscallReg()) + ")",
+ {"Func. (" + ProcessorHandler::currentISA()->regAlias(ProcessorHandler::currentISA()->syscallReg()) + ")",
"Name"});
m_ui->syscallList->horizontalHeader()->setStretchLastSection(true);
connect(m_ui->syscallList, &QTableWidget::currentItemChanged, this, &SyscallViewer::handleItemChanged);

MODIFY
test/riscv-tests/ranpi.c
test/riscv-tests/ranpi.c
@@ -19,8 +19,7 @@ void printFloat(float value) {
"ecall"
:
: [v] "r"(value)
- :
- );
+ :);
}
void printInt(int value) {
@@ -29,8 +28,7 @@ void printInt(int value) {
"ecall"
:
: [v] "r"(value)
- :
- );
+ :);
}
void printString(void* str) {
@@ -39,8 +37,7 @@ void printString(void* str) {
"ecall"
:
: [v] "r"(str)
- :
- );
+ :);
}
void printStringFloat(void* str, float f) {

MODIFY
test/tst_assembler.cpp
test/tst_assembler.cpp
@@ -68,13 +68,16 @@ private:
const auto* dataProg = res.program.getSection(".data");
const auto& dataSegment = res.program.getSection(".data")->data;
if (expectData.size() != dataSegment.size()) {
- err += "Expected data segment of size " + QString::number(expectData.size()) + "B but found " + QString::number(dataSegment.size()) + "B\n";
+ err += "Expected data segment of size " + QString::number(expectData.size()) + "B but found " +
+ QString::number(dataSegment.size()) + "B\n";
QFAIL(err.toStdString().c_str());
}
for (int i = 0; i < dataSegment.size(); i++) {
if (dataSegment.at(i) != expectData.at(i)) {
- err += "Discrepancy in data segment at byte " + QString::number(i) + " (address 0x" + QString::number(dataProg->address + i, 16) + ")\n";
- err += "expected 0x" + QString::number(expectData.at(i)) + " but found 0x" + QString::number(dataSegment.at(i)) + "\n";
+ err += "Discrepancy in data segment at byte " + QString::number(i) + " (address 0x" +
+ QString::number(dataProg->address + i, 16) + ")\n";
+ err += "expected 0x" + QString::number(expectData.at(i)) + " but found 0x" +
+ QString::number(dataSegment.at(i)) + "\n";
QFAIL(err.toStdString().c_str());
}
}

Apply clang-format to remaining files