Remove various useless anonymous namespace declarations
MODIFY
src/cachesim/cacheplotwidget.cpp
src/cachesim/cacheplotwidget.cpp
#include "limits.h"
-namespace {
+namespace Ripes {
-inline QPointF stepPoint(const QPointF& p1, const QPointF& p2) {
+static QPointF stepPoint(const QPointF& p1, const QPointF& p2) {
return QPointF(p2.x(), p1.y());
}
-} // namespace
-
-namespace Ripes {
-
CachePlotWidget::CachePlotWidget(QWidget* parent) : QWidget(parent), m_ui(new Ui::CachePlotWidget) {
m_ui->setupUi(this);
m_ui->plotView->setScene(new QGraphicsScene(this));

MODIFY
src/ccmanager.cpp
src/ccmanager.cpp
@@ -176,9 +176,7 @@ QString CCManager::getError() {
return get().m_process.readAllStandardError();
}
-namespace {
-
-QStringList sanitizedArguments(const QString& args) {
+static QStringList sanitizedArguments(const QString& args) {
QStringList arglist = args.split(" ");
for (const auto invArg : {"", " ", "-"}) {
arglist.removeAll(invArg);
@@ -186,8 +184,6 @@ QStringList sanitizedArguments(const QString& args) {
return arglist;
}
-} // namespace
-
CCManager::CompileCommand CCManager::createCompileCommand(const QStringList& files, const QString& outname) const {
const auto& currentISA = ProcessorHandler::currentISA();

MODIFY
src/editor/codeeditor.cpp
src/editor/codeeditor.cpp
@@ -85,7 +85,7 @@ void CodeEditor::updateSidebarWidth(int /* newBlockCount */) {
setViewportMargins(m_sidebarWidth, 0, 0, 0);
}
-inline int indentationOf(const QString& text) {
+static int indentationOf(const QString& text) {
int indent = 0;
for (const auto& ch : text) {
if (ch == " ") {

MODIFY
src/io/ioledmatrix.cpp
src/io/ioledmatrix.cpp
@@ -52,7 +52,7 @@ void IOLedMatrix::ioWrite(AInt offset, VInt value, unsigned) {
emit scheduleUpdate();
}
-inline QColor regToColor(uint32_t regVal) {
+static QColor regToColor(uint32_t regVal) {
return QColor(regVal >> 16 & 0xFF, regVal >> 8 & 0xFF, regVal & 0xFF);
}

MODIFY
src/isa/rv32isainfo.h
src/isa/rv32isainfo.h
@@ -26,8 +26,8 @@ public:
QString CCmarch() const override {
QString march = "rv32i";
- // Proceed in canonical order
- for (const auto& ext : {"M", "A", "F", "D"}) {
+ // Proceed in canonical order. Canonical ordering is defined in the RISC-V spec.
+ for (const auto& ext : {"M", "A", "F", "D", "C"}) {
if (m_enabledExtensions.contains(ext)) {
march += QString(ext).toLower();
}

MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
@@ -317,8 +317,7 @@ void MainWindow::version() {
aboutDialog.exec();
}
-namespace {
-void writeTextFile(QFile& file, const QString& data) {
+static void writeTextFile(QFile& file, const QString& data) {
if (file.open(QIODevice::WriteOnly)) {
QTextStream stream(&file);
stream << data;
@@ -326,15 +325,13 @@ void writeTextFile(QFile& file, const QString& data) {
}
}
-void writeBinaryFile(QFile& file, const QByteArray& data) {
+static void writeBinaryFile(QFile& file, const QByteArray& data) {
if (file.open(QIODevice::WriteOnly)) {
file.write(data);
file.close();
}
}
-} // namespace
-
void MainWindow::saveFilesTriggered() {
SaveDialog diag;
if (!RipesSettings::value(RIPES_SETTING_HAS_SAVEFILE).toBool()) {

MODIFY
src/pipelinediagrammodel.cpp
src/pipelinediagrammodel.cpp
namespace Ripes {
-static inline AInt indexToAddress(unsigned index) {
+static AInt indexToAddress(unsigned index) {
if (auto spt = ProcessorHandler::getProgram()) {
return (index * ProcessorHandler::currentISA()->instrBytes()) + spt->getSection(TEXT_SECTION_NAME)->address;
}

MODIFY
src/processortab.cpp
src/processortab.cpp
namespace Ripes {
-namespace {
-inline QString convertToSIUnits(const double l_value, int precision = 2) {
+static QString convertToSIUnits(const double l_value, int precision = 2) {
QString unit;
double value;
@@ -63,7 +62,6 @@ inline QString convertToSIUnits(const double l_value, int precision = 2) {
}
return QString::number(0) + " ";
}
-} // namespace
ProcessorTab::ProcessorTab(QToolBar* controlToolbar, QToolBar* additionalToolbar, QWidget* parent)
: RipesTab(additionalToolbar, parent), m_ui(new Ui::ProcessorTab) {

Remove various useless anonymous namespace declarations