Fix all warnings

This commit is contained in:
2023-09-22 10:45:23 +02:00
parent 8224e97abe
commit d2e5bd36de
25 changed files with 47 additions and 71 deletions

View File

@@ -277,7 +277,7 @@ const std::vector<CommentModel::Comment>& CommentModel::getComments() const
traceTime CommentModel::getTimeFromIndex(const QModelIndex& index) const
{
Q_ASSERT(comments.size() > index.row());
Q_ASSERT(index.row() > 0 && comments.size() > static_cast<unsigned>(index.row()));
return comments[index.row()].time;
}

View File

@@ -42,8 +42,8 @@
class DBPhaseEntryBase;
#define PASSFUNCTIONDECL \
(const std::shared_ptr<DBPhaseEntryBase> thisPhase, \
const std::shared_ptr<DBPhaseEntryBase> otherPhase)
([[maybe_unused]] const std::shared_ptr<DBPhaseEntryBase> thisPhase, \
[[maybe_unused]] const std::shared_ptr<DBPhaseEntryBase> otherPhase)
struct PassFunction
{
using Fn = std::function<bool PASSFUNCTIONDECL>;

View File

@@ -35,7 +35,7 @@
#include "configurationBase.h"
const uint ConfigurationBase::getClk() const
uint ConfigurationBase::getClk() const
{
if (!mDeviceDeps)
throw std::invalid_argument(
@@ -67,7 +67,7 @@ const QString ConfigurationBase::getDeviceName(const TraceDB& tdb)
return mGetMemspec(tdb)["memoryType"].toString();
}
const uint ConfigurationBase::mGetClk(const TraceDB& tdb)
uint ConfigurationBase::mGetClk(const TraceDB& tdb)
{
QSqlDatabase db = tdb.getDatabase();
QString query = "SELECT clk FROM GeneralInfo";

View File

@@ -50,7 +50,7 @@ public:
virtual std::shared_ptr<DBPhaseEntryBase> makePhaseEntry(const QSqlQuery&) const = 0;
// Delegated methods
const uint getClk() const;
uint getClk() const;
DependencyMap getDependencies(std::vector<QString>& commands) const;
PoolControllerMap getPools() const;
@@ -59,7 +59,7 @@ public:
protected:
std::shared_ptr<DRAMTimeDependenciesBase> mDeviceDeps = nullptr;
static const uint mGetClk(const TraceDB& tdb);
static uint mGetClk(const TraceDB& tdb);
static const QJsonObject mGetMemspec(const TraceDB& tdb);
QSqlQuery mExecuteQuery(const QString& queryStr);

View File

@@ -111,7 +111,6 @@ const std::vector<QString> ConfigurationFactory::possiblePhases(const TraceDB& t
bool ConfigurationFactory::deviceSupported(const TraceDB& tdb)
{
uint clk; // Not used
const QString deviceName = ConfigurationBase::getDeviceName(tdb);
if (deviceName == "DDR3")

View File

@@ -46,8 +46,8 @@ public:
DBPhaseEntryBase() = default;
virtual ~DBPhaseEntryBase() = default;
virtual bool potentialDependency(const TimeDependency& dep,
const std::shared_ptr<DBPhaseEntryBase> otherPhase)
virtual bool potentialDependency([[maybe_unused]] const TimeDependency& dep,
[[maybe_unused]] const std::shared_ptr<DBPhaseEntryBase> otherPhase)
{
return false;
}

View File

@@ -94,7 +94,7 @@ void DRAMTimeDependenciesBase::mFilterDependencyList(
[](const StringMapper& cmd, const StringMapper& depName)
{ return depName.isPool() || cmd < depName; });
if (dep.phaseDep.isPool() || it != dependencyFilter.end() && *it == dep.phaseDep)
if (dep.phaseDep.isPool() || (it != dependencyFilter.end() && *it == dep.phaseDep))
return true;
return false;

View File

@@ -47,7 +47,7 @@ public:
DependencyMap getDependencies(std::vector<QString>& dependencyFilter) const;
const uint getClk() const { return tCK; }
uint getClk() const { return tCK; }
PoolControllerMap getPools() const;

View File

@@ -129,8 +129,6 @@ void PhaseDependenciesTracker::mInsertIntoTable(TraceDB& tdb,
{
static const size_t bulkInsertionSize = 30;
auto numberOfEntries = entries.size();
QString command;
size_t counter = 0;
for (const auto& entry : entries)

View File

@@ -219,7 +219,6 @@ void Phase::drawPhaseDependencies(traceTime begin,
for (const auto& dep : mDependencies)
{
bool visible = false;
if (dep->isVisible())
{
if (!dep->draw(depLineTo, drawingProperties, painter, xMap, yMap))

View File

@@ -100,11 +100,11 @@ public:
row(row),
column(column),
burstLength(burstLength),
groupsPerRank(groupsPerRank),
banksPerGroup(banksPerGroup),
clk(clk),
transaction(transaction),
spansOnCommandBus(std::move(spansOnCommandBus)),
groupsPerRank(groupsPerRank),
banksPerGroup(banksPerGroup),
hexagonHeight(0.6),
captionPosition(TextPositioning::bottomRight)
{

View File

@@ -67,7 +67,7 @@ bool PhaseDependency::draw(QPoint& end,
if (mIsInvisible)
return false;
traceTime depBegin = mDependency->span.Begin();
// traceTime depBegin = mDependency->span.Begin();
traceTime depEnd = mDependency->span.End();
if (xMap.transform(depEnd) < 0)
@@ -91,13 +91,13 @@ void PhaseDependency::mDraw(QPoint& end,
const QwtScaleMap& yMap)
{
traceTime depBegin = mDependency->span.Begin();
traceTime depEnd = mDependency->span.End();
// traceTime depEnd = mDependency->span.End();
traceTime depOffset =
(depBegin == depEnd) ? static_cast<traceTime>(0.05 * mDependency->clk) : 0;
// traceTime depOffset =
// (depBegin == depEnd) ? static_cast<traceTime>(0.05 * mDependency->clk) : 0;
double depYVal = yMap.transform(depY);
double depSymbolHeight = yMap.transform(0) - yMap.transform(mDependency->hexagonHeight);
// double depSymbolHeight = yMap.transform(0) - yMap.transform(mDependency->hexagonHeight);
QPoint depLineFrom(
static_cast<int>(xMap.transform(depBegin /* + (depEnd + depOffset - depBegin)/4*/)),
static_cast<int>(depYVal));

View File

@@ -87,7 +87,7 @@ public:
{
mSNumTransactions = numTransactions;
}
static unsigned int getNumTransactions(const unsigned int numTransactions)
static unsigned int getNumTransactions()
{
return mSNumTransactions;
}

View File

@@ -72,14 +72,6 @@ int main(int argc, char* argv[])
for (int i = 1; i < argc; ++i)
arguments.insert(QString(argv[i]));
StartupOption startupOption = StartupOption::showPlots;
QString testflag("-t");
if (arguments.contains(testflag))
{
startupOption = StartupOption::runTests;
arguments.remove(testflag);
}
QString openFolderFlag("-f");
if (arguments.contains(openFolderFlag))
{
@@ -98,7 +90,7 @@ int main(int argc, char* argv[])
}
}
TraceAnalyzer analyzer(arguments, startupOption);
TraceAnalyzer analyzer(arguments);
analyzer.show();
return a.exec();
}

View File

@@ -46,16 +46,16 @@ void SelectedTransactionTreeWidget::selectedTransactionsChanged()
}
expandAll();
for (size_t k = 0; k < topLevelItemCount(); k++)
for (int k = 0; k < topLevelItemCount(); k++)
{
auto node = topLevelItem(k);
for (size_t i = 0; i < node->childCount(); i++)
for (int i = 0; i < node->childCount(); i++)
{
if (node->child(i)->text(0) == "Phases")
{
auto phaseNode = node->child(i);
for (size_t j = 0; j < phaseNode->childCount(); j++)
for (int j = 0; j < phaseNode->childCount(); j++)
phaseNode->child(j)->setExpanded(false);
}
}

View File

@@ -64,8 +64,6 @@ void TraceDrawingProperties::updateLabels()
// The lowest line starts at the y value of 0.
int yVal = 0;
auto selectedModel = tracePlotLineDataSource->getSelectedModel();
for (auto it = tracePlotLineDataSource->getTracePlotLines().rbegin();
it != tracePlotLineDataSource->getTracePlotLines().rend();
++it)

View File

@@ -120,7 +120,7 @@ void TraceNavigator::refreshData()
void TraceNavigator::addSelectedTransactions(const vector<shared_ptr<Transaction>>& transactions)
{
for (const auto transaction : transactions)
for (const auto &transaction : transactions)
{
selectedTransactions.push_back(transaction);
}

View File

@@ -465,7 +465,7 @@ ToggleCollapsedAction::CollapsedState TracePlot::getCollapsedState() const
auto selectedModel = tracePlotLineDataSource->getSelectedModel();
for (unsigned int i = 0; i < selectedModel->rowCount(); i++)
for (int i = 0; i < selectedModel->rowCount(); i++)
{
QModelIndex index = selectedModel->index(i, 0);
auto type = static_cast<AbstractTracePlotLineModel::LineType>(
@@ -496,7 +496,7 @@ void TracePlot::collapseOrExpandAllRanks(ToggleCollapsedAction::CollapseAction c
using CollapseAction = ToggleCollapsedAction::CollapseAction;
auto selectedModel = tracePlotLineDataSource->getSelectedModel();
for (unsigned int i = 0; i < selectedModel->rowCount(); i++)
for (int i = 0; i < selectedModel->rowCount(); i++)
{
QModelIndex index = selectedModel->index(i, 0);
auto type = static_cast<AbstractTracePlotLineModel::LineType>(

View File

@@ -294,6 +294,7 @@ bool TraceScroller::eventFilter(QObject* object, QEvent* event)
static_cast<traceTime>(invTransform(xBottom, mouseEvent->x())));
return true;
}
break;
}
case QEvent::MouseButtonRelease:
{
@@ -305,6 +306,7 @@ bool TraceScroller::eventFilter(QObject* object, QEvent* event)
canvas()->setCursor(Qt::ArrowCursor);
return true;
}
break;
}
case QEvent::MouseMove:
{

View File

@@ -36,8 +36,8 @@
#include "customlabelscaledraw.h"
CustomLabelScaleDraw::CustomLabelScaleDraw(std::shared_ptr<QHash<int, QString>> labels) :
labels(labels),
QObject(nullptr)
QObject(nullptr),
labels(labels)
{
}

View File

@@ -62,16 +62,16 @@ void TraceAnalyzer::setUpGui()
TraceAnalyzer::TraceAnalyzer(QWidget* parent) :
QMainWindow(parent),
ui(new Ui::TraceAnalyzer),
evaluationTool(pythonCaller)
evaluationTool(pythonCaller),
ui(new Ui::TraceAnalyzer)
{
setUpGui();
}
TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, StartupOption option, QWidget* parent) :
TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, QWidget* parent) :
QMainWindow(parent),
ui(new Ui::TraceAnalyzer),
evaluationTool(pythonCaller)
evaluationTool(pythonCaller),
ui(new Ui::TraceAnalyzer)
{
setUpGui();
@@ -262,7 +262,7 @@ void TraceAnalyzer::on_actionAbout_triggered()
void TraceAnalyzer::closeEvent(QCloseEvent* event)
{
for (unsigned int i = 0; i < ui->traceFileTabs->count(); i++)
for (int i = 0; i < ui->traceFileTabs->count(); i++)
{
QWidget* tab = ui->traceFileTabs->widget(i);
if (!tab->close())

View File

@@ -51,17 +51,6 @@ namespace Ui
class TraceAnalyzer;
}
enum class StartupOption
{
showPlots,
runTests
};
enum class OpenOptions
{
files,
folders
};
class TraceFileTab;
class TraceAnalyzer : public QMainWindow
@@ -70,7 +59,7 @@ class TraceAnalyzer : public QMainWindow
public:
explicit TraceAnalyzer(QWidget* parent = nullptr);
explicit TraceAnalyzer(QSet<QString> paths, StartupOption option, QWidget* parent = nullptr);
explicit TraceAnalyzer(QSet<QString> paths, QWidget* parent = nullptr);
~TraceAnalyzer();
void setUpStatusBar();

View File

@@ -61,7 +61,6 @@
#include <qwt_plot_canvas.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_histogram.h>
#include <qwt_plot_layout.h>
#include <qwt_plot_magnifier.h>
#include <qwt_plot_panner.h>
#include <qwt_scale_draw.h>
@@ -74,6 +73,7 @@ TraceFileTab::TraceFileTab(std::string_view traceFilePath,
PythonCaller& pythonCaller,
QWidget* parent) :
QWidget(parent),
traceFilePath(traceFilePath),
ui(new Ui::TraceFileTab),
commentModel(new CommentModel(this)),
navigator(new TraceNavigator(traceFilePath.data(), commentModel, this)),
@@ -83,9 +83,8 @@ TraceFileTab::TraceFileTab(std::string_view traceFilePath,
selectedRowsModel(new SelectedTracePlotLineModel(navigator->GeneralTraceInfo(), this)),
tracePlotLineDataSource(new TracePlotLineDataSource(selectedRowsModel, this)),
depInfosView(new DependencyInfosModel(navigator->TraceFile(), this)),
savingChangesToDB(false),
pythonCaller(pythonCaller),
traceFilePath(traceFilePath)
savingChangesToDB(false)
{
ui->setupUi(this);
@@ -101,7 +100,7 @@ TraceFileTab::TraceFileTab(std::string_view traceFilePath,
ui->depInfosView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
setUpTraceSelector();
initNavigatorAndItsDependentWidgets(traceFilePath.data());
initNavigatorAndItsDependentWidgets();
setUpFileWatcher(traceFilePath.data());
setUpTraceplotScrollbar();
setUpCommentView();
@@ -181,7 +180,7 @@ void TraceFileTab::setUpTraceplotScrollbar()
SLOT(verticalScrollbarChanged(int)));
}
void TraceFileTab::initNavigatorAndItsDependentWidgets(QString path)
void TraceFileTab::initNavigatorAndItsDependentWidgets()
{
ui->traceplot->init(navigator, ui->traceplotScrollbar, tracePlotLineDataSource, commentModel);
@@ -567,10 +566,10 @@ void TraceFileTab::on_startPowerAnalysis_clicked()
ui->bandwidthPlot->replot();
// Buffer analysis:
sql = "select max(BufferNumber) from BufferDepth;";
query.exec(sql);
query.next();
unsigned int numberOfBuffers = query.value(0).toUInt();
// sql = "select max(BufferNumber) from BufferDepth;";
// query.exec(sql);
// query.next();
// unsigned int numberOfBuffers = query.value(0).toUInt();
sql = "select MaxBufferDepth from GeneralInfo;";
query.exec(sql);

View File

@@ -78,7 +78,7 @@ public:
void setUpTraceSelector();
void setUpPossiblePhases();
void initNavigatorAndItsDependentWidgets(QString path);
void initNavigatorAndItsDependentWidgets();
QString getPathToTraceFile() { return traceFilePath.data(); }
void commitChangesToDB(void);
void exportAsVCD();