Skip to content

Commit

Permalink
Resolve a compiler warnings and make compiler more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
ximion committed May 6, 2024
1 parent f9a5129 commit d077aec
Show file tree
Hide file tree
Showing 31 changed files with 108 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Engine/API/Hardware/rhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ bool RHXController::uploadFPGABitfile(const string& filename)
boardId = dev->GetWireOutValue(WireOutBoardId);
boardVersion = dev->GetWireOutValue(WireOutBoardVersion);

cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n\n";
std::cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n" << std::endl;

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void FilePerChannelManager::updateEndOfData()
// TODO - polish up to get the actual end of all data, not just assume from end of shortest amp file
int tempTotalNumSamples = 0;
for (int stream = 0; stream < info->numDataStreams; ++stream) {
for (int channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
for (uint channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
if (amplifierWasSaved[stream][channel]) {
int64_t numAmpSamples = amplifierFiles[stream][channel]->fileSize() / 2;
if (numAmpSamples < tempTotalNumSamples || tempTotalNumSamples == 0) {
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/DataFileReaders/fileperchannelmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FilePerChannelManager : public DataFileManager
DataFileReader* parent);
~FilePerChannelManager();

long readDataBlocksRaw(int numBlocks, uint8_t* buffer);
long readDataBlocksRaw(int numBlocks, uint8_t* buffer) override;
int64_t getLastTimeStamp() override;
int64_t jumpToTimeStamp(int64_t target) override;
void loadDataFrame() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ int64_t TraditionalIntanFileManager::blocksPresent()
{
// Should remain accurate even if data file continues growing
int dataSizeBytes = 0;
for (int i = 0; i < consecutiveFiles.size(); i++) {
for (uint i = 0; i < consecutiveFiles.size(); i++) {
dataSizeBytes += QFileInfo(consecutiveFiles[i].fileName).size() - info->headerSizeInBytes;
}
return dataSizeBytes / info->bytesPerDataBlock;
Expand Down
6 changes: 5 additions & 1 deletion Engine/Processing/XPUInterfaces/gpuinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,12 @@ bool GPUInterface::createKernel(int devIndex)
state->writeToLog("Completed clCreateContext()");

state->writeToLog("About to call clCreateCommandQueue");
cl_queue_properties properties[] = {
CL_QUEUE_PROPERTIES,
0 // Terminates the list
};
// Create command queue.
commandQueue = clCreateCommandQueue(context, id, 0, &ret);
commandQueue = clCreateCommandQueueWithProperties(context, id, properties, &ret);
if (ret != CL_SUCCESS) {
state->writeToLog("Failure creating OpenCL commandqueue. Ret: " + QString::number(ret));
gpuErrorMessage("Error creating OpenCL commandqueue. Returned error code: " + QString::number(ret));
Expand Down
10 changes: 7 additions & 3 deletions Engine/Processing/XPUInterfaces/xpucontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

XPUController::XPUController(SystemState *state_, bool useOpenCL_, QObject *parent) :
QObject(parent),
useOpenCL(useOpenCL_),
state(state_),
usedXPUIndex(-1),
useOpenCL(useOpenCL_)
usedXPUIndex(-1)
{
state->writeToLog("Entered XPUController ctor");
connect(state, SIGNAL(stateChanged()), this, SLOT(updateFromState()));
Expand Down Expand Up @@ -126,7 +126,11 @@ void XPUController::updateFromState()
if (state->usedXPUIndex() != usedXPUIndex) {
activeInterface->cleanupMemory();
usedXPUIndex = state->usedXPUIndex();
activeInterface = (usedXPUIndex == 0) ? activeInterface = cpuInterface : activeInterface = gpuInterface;
if (usedXPUIndex == 0) {
activeInterface = cpuInterface;
} else {
activeInterface = gpuInterface;
}
activeInterface->setupMemory();
}
activeInterface->updateFromState();
Expand Down
8 changes: 7 additions & 1 deletion Engine/Processing/commandparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

CommandParser::CommandParser(SystemState* state_, ControllerInterface *controllerInterface_, QObject *parent) :
QObject(parent),
controllerInterface(controllerInterface_),
controlWindow(nullptr),
controllerInterface(controllerInterface_),
state(state_)
{
// These connections allow for interactions with communicators that may live in another thread
Expand Down Expand Up @@ -871,6 +871,8 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDacSignal:
// PulseTrainPeriod cannot be less than stimDuration (which depends on Shape)
// Biphasic: stimDuration = FirstPhaseDuration + SecondPhaseDuration
Expand All @@ -888,11 +890,15 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDigitalOutSignal:
// PulseTrainPeriod cannot be less than FirstPhaseDuration
if (stimParams->pulseTrainPeriod->getValue() < stimParams->firstPhaseDuration->getValue())
return "PulseTrainPeriodMicroseconds cannot be less than pulse duration (FirstPhaseDurationMicroseconds)";

break;

default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/controllerinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int ControllerInterface::scanPorts(vector<ChipType> &chipType, vector<int> &port
state->previousDelaySelectedPort->getValue(),
state->lastDetectedChip->getValue());

for (int i = 0; i < chipType.size(); i++) {
for (uint i = 0; i < chipType.size(); i++) {
if (chipType[i] != NoChip) {
state->lastDetectedChip->setValue((int) chipType[i]);
break;
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/softwarereferenceprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void SoftwareReferenceProcessor::readReferenceSamples(vector<StreamChannelPair>
{
const uint16_t* pRead;

for (int i = 0; i < addresses.size(); ++i) {
for (uint i = 0; i < addresses.size(); ++i) {
pRead = start;
pRead += 6; // Skip header and timestamp.
pRead += misoWordSize * (numDataStreams * 3); // Skip auxiliary channels.
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/stateitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class StateFilenameItem : public StateItem
bool isValid() const { return !path.isEmpty() && !baseFilename.isEmpty(); }
QString getFullFilename() const { return isValid() ? path + "/" + baseFilename : ""; }

QString getValidValues() const { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }
QString getValidValues() const override { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }

private:
QString path;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/waveformfifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include "waveformfifo.h"

WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBlocks_, int memorySizeInDataBlocks_, int maxWriteSizeInDataBlocks_, SystemState* state_) :
state(state_),
signalSources(signalSources_),
bufferSizeInDataBlocks(bufferSizeInDataBlocks_),
memorySizeInDataBlocks(memorySizeInDataBlocks_),
maxWriteSizeInDataBlocks(maxWriteSizeInDataBlocks_),
numReaders(NumberOfReaders),
state(state_)
numReaders(NumberOfReaders)
{
if (numReaders < 1) {
cerr << "WaveformFifo constructor: numReaders must be one or greater." << '\n';
Expand All @@ -64,7 +64,7 @@ WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBl
bufferAllocateSize = bufferSize + maxWriteSizeInSamples;
bufferAllocateSizeInBlocks = bufferSizeInDataBlocks + maxWriteSizeInDataBlocks;

usedWordsNewData = new Semaphore [numReaders];
usedWordsNewData = new Semaphore[numReaders];
bufferReadIndex.resize(numReaders);
bufferMemoryIndex.resize(numReaders);
numWordsToBeRead.resize(numReaders);
Expand Down
3 changes: 1 addition & 2 deletions Engine/Processing/waveformfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <map>
#include <vector>
#include <mutex>
#include "rhxglobals.h"
#include "semaphore.h"
#include "minmax.h"
#include "signalsources.h"
Expand Down Expand Up @@ -76,7 +75,7 @@ const uint8_t SpikeIdLikelyArtifact = 0x80u;
class WaveformFifo
{
public:
enum Reader {
enum Reader : uint {
ReaderDisplay = 0,
ReaderDisk,
ReaderAudio,
Expand Down
4 changes: 2 additions & 2 deletions Engine/Processing/xmlinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
errorMessage.append("\n");
}
errorMessage.append("Warning: The following channels are currently detected by the Intan controller but are not included in the settings file:");
for (int i = 0; i < uninitializedChannels.size(); ++i) {
for (uint i = 0; i < uninitializedChannels.size(); ++i) {
errorMessage.append("\n" + QString::fromStdString(uninitializedChannels[i]));
}
}
Expand Down Expand Up @@ -576,7 +576,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString
vector<string> XMLInterface::findUninitializedChannels(vector<string> allChannels, vector<bool> channelsInitializedFromXML) const
{
vector<string> uninitializedChannels;
for (int i = 0; i < allChannels.size(); ++i) {
for (uint i = 0; i < allChannels.size(); ++i) {
if (!channelsInitializedFromXML[i]) {
uninitializedChannels.push_back(allChannels[i]);
}
Expand Down
4 changes: 2 additions & 2 deletions Engine/Threads/tcpdataoutputthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ TCPDataOutputThread::TCPDataOutputThread(WaveformFifo *waveformFifo_, const doub
QThread(parent),
tcpWaveformDataCommunicator(state_->tcpWaveformDataCommunicator),
tcpSpikeDataCommunicator(state_->tcpSpikeDataCommunicator),
previousSample(nullptr),
waveformFifo(waveformFifo_),
signalSources(state_->signalSources),
sampleRate(sampleRate_),
Expand All @@ -42,8 +43,7 @@ TCPDataOutputThread::TCPDataOutputThread(WaveformFifo *waveformFifo_, const doub
stopThread(false),
parentObject(parent),
connected(false),
state(state_),
previousSample(nullptr)
state(state_)
{
}

Expand Down
6 changes: 3 additions & 3 deletions GUI/Dialogs/advancedstartupdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ AdvancedStartupDialog::AdvancedStartupDialog(bool &useOpenCL_, uint8_t &playback
playbackFCheckBox(nullptr),
playbackGCheckBox(nullptr),
playbackHCheckBox(nullptr),
playbackPorts(&playbackPorts_),
demoMode(demoMode_),
buttonBox(nullptr),
useOpenCL(&useOpenCL_),
tempUseOpenCL(useOpenCL_)
tempUseOpenCL(useOpenCL_),
playbackPorts(&playbackPorts_),
demoMode(demoMode_)
{
useOpenCLDescription = new QLabel(tr(
"OpenCL is a platform-independent framework that allows the CPU to\n"
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/advancedstartupdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AdvancedStartupDialog : public QDialog
static uint8_t portsBoolToInt(QVector<bool> portsBool);

public slots:
void accept();
void accept() override;

private slots:
void changeUseOpenCL(bool use);
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/anoutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AnOutDialog : public QDialog
void loadParameters(StimParameters* parameters);

public slots:
void accept();
void accept() override;
void notifyFocusChanged(QWidget *lostFocus, QWidget *gainedFocus);

private:
Expand Down
6 changes: 3 additions & 3 deletions GUI/Dialogs/boardselectdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ BoardSelectDialog::BoardSelectDialog(QWidget *parent) :
openButton(nullptr),
playbackButton(nullptr),
advancedButton(nullptr),
useOpenCL(true),
playbackPorts(255),
defaultSampleRateCheckBox(nullptr),
defaultSettingsFileCheckBox(nullptr),
splash(nullptr),
Expand All @@ -380,7 +378,9 @@ BoardSelectDialog::BoardSelectDialog(QWidget *parent) :
state(nullptr),
controllerInterface(nullptr),
parser(nullptr),
controlWindow(nullptr)
controlWindow(nullptr),
useOpenCL(true),
playbackPorts(255)
{
// Information used by QSettings to save basic settings across sessions.
QCoreApplication::setOrganizationName(OrganizationName);
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/digoutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DigOutDialog : public QDialog
void loadParameters(StimParameters* parameters);

public slots:
void accept();
void accept() override;
void notifyFocusChanged(QWidget *lostFocus, QWidget *gainedFocus);

private:
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/stimparamdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class StimParamDialog : public QDialog
void activate();

public slots:
void accept();
void accept() override;

private slots:
void notifyFocusChanged(QWidget* lostFocus, QWidget* gainedFocus);
Expand Down
4 changes: 2 additions & 2 deletions GUI/Widgets/abstractpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ void ColorWidget::setColor(QColor color)
}

AbstractPanel::AbstractPanel(ControllerInterface* controllerInterface_, SystemState* state_, CommandParser* parser_, ControlWindow *parent) :
controlWindow(parent),
controllerInterface(controllerInterface_),
state(state_),
parser(parser_),
controlWindow(parent),
controllerInterface(controllerInterface_),
filterDisplaySelector(nullptr),
tabWidget(nullptr),
configureTab(nullptr),
Expand Down
6 changes: 3 additions & 3 deletions GUI/Widgets/anoutfigure.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AnOutFigure : public AbstractFigure
Q_OBJECT
public:
explicit AnOutFigure(StimParameters* stimParameters, QWidget *parent = nullptr);
void uniqueRedraw(QPainter &painter);
void uniqueRedraw(QPainter &painter) override;

public slots:
void updateMonophasicAndPositive(bool logicValue);
Expand All @@ -51,8 +51,8 @@ public slots:
void highlightBaselineVoltage(bool highlight);

private:
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
bool localMonophasicAndPositive;
QColor oldColor;
};
Expand Down
5 changes: 2 additions & 3 deletions GUI/Widgets/controlpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
//
//------------------------------------------------------------------------------

#include "stimparamdialog.h"
#include "anoutdialog.h"
#include "digoutdialog.h"
#include "controlpanelbandwidthtab.h"
#include "controlpanelimpedancetab.h"
#include "controlpanelaudioanalogtab.h"
Expand Down Expand Up @@ -182,6 +179,8 @@ QString ControlPanel::currentTabName() const
} else {
qDebug() << "Unrecognized tab widget.";
}

return QString();
}

QHBoxLayout* ControlPanel::createSelectionLayout()
Expand Down
2 changes: 1 addition & 1 deletion GUI/Widgets/controlpanelconfiguretab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
ControlPanelConfigureTab::ControlPanelConfigureTab(ControllerInterface* controllerInterface_, SystemState* state_,
CommandParser* parser_, QWidget *parent) :
QWidget(parent),
fastSettleCheckBox(nullptr),
state(state_),
parser(parser_),
controllerInterface(controllerInterface_),
scanButton(nullptr),
setCableDelayButton(nullptr),
digOutButton(nullptr),
fastSettleCheckBox(nullptr),
externalFastSettleCheckBox(nullptr),
externalFastSettleSpinBox(nullptr),
note1LineEdit(nullptr),
Expand Down
6 changes: 3 additions & 3 deletions GUI/Widgets/digfigure.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class DigFigure : public AbstractFigure
Q_OBJECT
public:
explicit DigFigure(StimParameters* stimParameters, QWidget* parent = nullptr);
void uniqueRedraw(QPainter &painter);
void uniqueRedraw(QPainter &painter) override;

private:
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
};


Expand Down
Loading

0 comments on commit d077aec

Please sign in to comment.