Add wextra level warnings.

This commit is contained in:
James Grogan 2023-01-23 11:55:58 +00:00
parent e559f9674d
commit 119ea6f2cc
62 changed files with 235 additions and 231 deletions

View file

@ -20,7 +20,7 @@ if(MSVC)
else()
#set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
#set(GCC_COVERAGE_LINK_FLAGS "-lgcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
endif()

View file

@ -11,14 +11,14 @@ CanvasCommandSelectorView::CanvasCommandSelectorView()
{
auto circle_button = Button::Create();
auto on_circle_click = [this](Widget* self){
auto on_circle_click = [this](Widget*){
onCommandSelected(CanvasDrawCommand::CIRCLE);
};
circle_button->setLabel("Circle");
circle_button->setMargin(2);
circle_button->setOnClickFunction(on_circle_click);
auto on_line_click = [this](Widget* self){
auto on_line_click = [this](Widget*){
onCommandSelected(CanvasDrawCommand::LINE);
};
auto line_button = Button::Create();

View file

@ -31,7 +31,7 @@ bool CanvasDrawingArea::isDirty() const
return Widget::isDirty() || mContentDirty;
}
void CanvasDrawingArea::doPaint(const PaintEvent* event)
void CanvasDrawingArea::doPaint(const PaintEvent*)
{
mContentDirty = false;
}

View file

@ -35,7 +35,7 @@ void TextEditorView::initialize()
saveButton->setLabel("Save");
saveButton->setBackground(Theme::Sys::Color::Primary);
saveButton->setMargin(2);
auto onSave = [this](Widget* self){
auto onSave = [this](Widget*){
if(mController && mTextBox)
{
mController->SetContent(mTextBox->getContent());
@ -47,7 +47,7 @@ void TextEditorView::initialize()
auto clearButton = Button::Create();
clearButton->setLabel("Clear");
clearButton->setMargin(2);
auto onClear = [this](Widget* self){
auto onClear = [this](Widget*){
if(mController && mTextBox)
{
mController->OnClear();
@ -59,7 +59,7 @@ void TextEditorView::initialize()
auto loadButton = Button::Create();
loadButton->setLabel("Load");
loadButton->setMargin(2);
auto onLoad = [this](Widget* self){
auto onLoad = [this](Widget*){
if(mController && mTextBox)
{
mController->OnLoad();

View file

@ -8,7 +8,7 @@ class TruthTable
public:
using TableData = std::map<std::vector<bool>, std::vector<bool> >;
TruthTable(std::size_t numInputColumns, std::size_t numOutputColumns)
TruthTable(std::size_t, std::size_t)
//: mNumInputColumns(numInputColumns),
// mNumOutputColumns(numOutputColumns)
{

View file

@ -21,7 +21,7 @@ void ElectronicCircuitNode::setContent(ElectronicCircuit* content)
mContentDirty = true;
}
void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo*)
{
mInputTerminalNodes.clear();
mWireNodes.clear();

View file

@ -33,7 +33,7 @@ void LogicGateNode::update(SceneInfo* sceneInfo)
}
}
void LogicGateNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
void LogicGateNode::createOrUpdateGeometry(SceneInfo*)
{
if (!mPrimaryPath)
{

View file

@ -13,7 +13,7 @@ void TerminalNode::setContent(Terminal* terminal)
mContent = terminal;
}
void TerminalNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
void TerminalNode::createOrUpdateGeometry(SceneInfo*)
{
if (!mMarker)
{

View file

@ -129,7 +129,7 @@ int MidiMetaEventAdapter::ReadChannelPrefixEvent(std::ifstream* file, MetaMidiEv
return byteCount;
}
int MidiMetaEventAdapter::ReadTimeSignatureEvent(std::ifstream* file, MetaMidiEvent* event)
int MidiMetaEventAdapter::ReadTimeSignatureEvent(std::ifstream* file, MetaMidiEvent*)
{
unsigned byteCount = 0;
int length = *BinaryStream::getNextByteAsInt(file);
@ -154,7 +154,7 @@ int MidiMetaEventAdapter::ReadTimeSignatureEvent(std::ifstream* file, MetaMidiEv
return byteCount;
}
int MidiMetaEventAdapter::ReadKeySignatureEvent(std::ifstream* file, MetaMidiEvent* event)
int MidiMetaEventAdapter::ReadKeySignatureEvent(std::ifstream* file, MetaMidiEvent*)
{
unsigned byteCount = 0;
int length = *BinaryStream::getNextByteAsInt(file);
@ -168,7 +168,7 @@ int MidiMetaEventAdapter::ReadKeySignatureEvent(std::ifstream* file, MetaMidiEve
return byteCount;
}
int MidiMetaEventAdapter::ReadTimeCodeEvent(std::ifstream* file, MetaMidiEvent* event)
int MidiMetaEventAdapter::ReadTimeCodeEvent(std::ifstream* file, MetaMidiEvent*)
{
unsigned byteCount = 0;
int length = *BinaryStream::getNextByteAsInt(file);

View file

@ -24,7 +24,7 @@ void BlochSphereNode::setSize(double size)
}
}
void BlochSphereNode::update(SceneInfo* sceneInfo)
void BlochSphereNode::update(SceneInfo*)
{
if (!mContentDirty)
{

View file

@ -113,7 +113,7 @@ const std::string& TemplateExpression::getContent() const
return mContent;
}
std::string TemplateExpression::render(TemplateSubstitutionContext* substitutions, TemplateNode* parentContext)
std::string TemplateExpression::render(TemplateSubstitutionContext* substitutions, TemplateNode*)
{
if (substitutions && substitutions->hasSubstitution(mContent))
{
@ -143,7 +143,7 @@ bool TemplateTextBody::hasContent() const
return !mContent.empty();
}
std::string TemplateTextBody::render(TemplateSubstitutionContext* substitutions, TemplateNode* parentContext)
std::string TemplateTextBody::render(TemplateSubstitutionContext*, TemplateNode*)
{
std::string content;
for(unsigned idx=0; idx<mContent.size(); idx++)

View file

@ -191,7 +191,7 @@ void TemplateFile::onFoundBlock(const std::vector<std::string> args)
mWorkingNode = temp;
}
void TemplateFile::onFoundEndBlock(const std::vector<std::string> args)
void TemplateFile::onFoundEndBlock(const std::vector<std::string>)
{
mWorkingNode = mWorkingNode->getParent();
}

View file

@ -107,7 +107,7 @@ void HuffmanEncoder::setUseFixedCode(bool useFixed)
mUseFixedCode = useFixed;
}
uint32_t HuffmanEncoder::getLengthValue(unsigned length)
uint32_t HuffmanEncoder::getLengthValue(unsigned)
{
return 0;
}

View file

@ -77,7 +77,7 @@ bool HuffmanStream::readNextDistanceSymbol(unsigned& buffer)
return true;
}
void HuffmanStream::addValue(unsigned value, unsigned& count, unsigned& lastValue, std::vector<unsigned char>& literals, unsigned numLiterals, std::vector<unsigned char>& distances)
void HuffmanStream::addValue(unsigned value, unsigned& count, unsigned& lastValue, std::vector<unsigned char>& literals, unsigned, std::vector<unsigned char>& distances)
{
if (count < mNumLiterals)
{

View file

@ -29,6 +29,8 @@ void CommandLineArgs::initialize(CommandLineArgs* args)
::LocalFree(szArglist);
args->process(windowsArgs);
#else
(void)args;
#endif
}

View file

@ -36,7 +36,7 @@ std::string File::dumpBinary()
const unsigned char val = static_cast<unsigned char>(mInHandle->get());
const unsigned char ascii_val = std::isalpha(val) ? val : '.';
sstr << count << " | " << ByteUtils::toString(val) << " | " << static_cast<int>(val) << " | " << ascii_val << '\n';
if (count < 0 && count % 10 == 0)
if (count % 10 == 0)
{
sstr << "\n";
}

View file

@ -62,7 +62,7 @@ void FileLogger::LogLine(const std::string& logType, const std::ostringstream& l
std::time_t t = std::time(nullptr);
const std::string cleanedFileName = fileName.substr(fileName.find_last_of("/\\") + 1);
std::tm time_buf = { 0 };
std::tm time_buf{ };
#ifdef WIN32
gmtime_s(&time_buf, &t);
#else

View file

@ -16,7 +16,7 @@ class InputBitStream : public BitStream
void writeByte(unsigned char data, bool checkOverflow = true) override;
void writeBytes(const std::vector<unsigned char> data) override
void writeBytes(const std::vector<unsigned char>) override
{
}

View file

@ -29,7 +29,7 @@ void SqliteInterface::open(Database* db)
}
}
static int callback(void *NotUsed, int argc, char **argv, char **azColName)
static int callback(void *, int argc, char **, char **)
{
for(int i=0; i<argc; i++)
{

View file

@ -64,7 +64,7 @@ const Point& Arc::getLocation() const
return mStartPoint;
}
void Arc::sample(SparseGrid<bool>* grid) const
void Arc::sample(SparseGrid<bool>*) const
{
}

View file

@ -20,7 +20,7 @@ public:
CurveType getCurveType() const override;
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
std::string toPostScriptString(std::size_t precision = 0) const override;

View file

@ -49,7 +49,7 @@ const Point& CubicBezierCurve::getLocation() const
return mStartPoint;
}
void CubicBezierCurve::sample(SparseGrid<bool>* grid) const
void CubicBezierCurve::sample(SparseGrid<bool>*) const
{
}

View file

@ -20,7 +20,7 @@ public:
CurveType getCurveType() const override;
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
std::string toPostScriptString(std::size_t precision = 0) const override;

View file

@ -35,7 +35,7 @@ public:
Point getEndPoint() const override;
void sample(SparseGrid<bool>* grid) const override {};
void sample(SparseGrid<bool>*) const override {};
std::string toPostScriptString(std::size_t precision = 0) const override;

View file

@ -29,7 +29,7 @@ const Point& LineSegment::getPoint1() const
return mP1;
}
void LineSegment::sample(SparseGrid<bool>* grid) const
void LineSegment::sample(SparseGrid<bool>*) const
{
}

View file

@ -31,7 +31,7 @@ public:
bool isVertical() const;
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
std::string toPostScriptString(std::size_t precision = 0) const override;

View file

@ -43,7 +43,7 @@ GeometryPath::Type GeometryPath::getType() const
return GeometryPath::Type::PATH;
}
void GeometryPath::sample(SparseGrid<bool>* grid) const
void GeometryPath::sample(SparseGrid<bool>*) const
{
}

View file

@ -55,7 +55,7 @@ public:
const std::vector<GeometryPathFeaturePtr>& getFeatures() const;
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
private:
Point mLocation;

View file

@ -42,7 +42,7 @@ const Point& QuadraticBezierCurve::getLocation() const
return mStartPoint;
}
void QuadraticBezierCurve::sample(SparseGrid<bool>* grid) const
void QuadraticBezierCurve::sample(SparseGrid<bool>*) const
{
}

View file

@ -20,7 +20,7 @@ public:
CurveType getCurveType() const override;
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
std::string toPostScriptString(std::size_t precision = 0) const override;

View file

@ -28,7 +28,7 @@ void Circle::setMinorRadius(double radius)
mMinorRadius = radius;
}
void Circle::sample(SparseGrid<bool>* grid) const
void Circle::sample(SparseGrid<bool>*) const
{
}

View file

@ -22,7 +22,7 @@ public:
void setMinorRadius(double radius);
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
private:
double mMinorRadius{ 0.5 };

View file

@ -32,7 +32,7 @@ namespace ntk {
return { minX , maxX , minY , maxY };
}
void Rectangle::sample(SparseGrid<bool>* grid) const
void Rectangle::sample(SparseGrid<bool>*) const
{
}

View file

@ -23,7 +23,7 @@ public:
void setRadius(double radius);
void sample(SparseGrid<bool>* grid) const override;
void sample(SparseGrid<bool>*) const override;
private:
Point mBottomLeft;

View file

@ -37,6 +37,8 @@ void NetworkManager::runHttpServer(AbstractWebApp* webApp)
server.initialize();
server.run();
#else
(void)webApp;
if (!mSocketInterface)
{
initialize();

View file

@ -58,7 +58,7 @@ void AlsaInterface::openDevice(AudioDevice* device)
}
}
void AlsaInterface::setAccessType(AudioDevice* device)
void AlsaInterface::setAccessType(AudioDevice*)
{
if (snd_pcm_hw_params_set_access(mHandle, mHardwareParams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
{
@ -67,7 +67,7 @@ void AlsaInterface::setAccessType(AudioDevice* device)
}
}
bool AlsaInterface::setSampleFormat(AudioDevice* device)
bool AlsaInterface::setSampleFormat(AudioDevice*)
{
/* Set sample format */
if (snd_pcm_hw_params_set_format(mHandle, mHardwareParams, SND_PCM_FORMAT_S16_LE) < 0)

View file

@ -14,7 +14,7 @@ bool ImageBitStream::isFinished() const
return mByteOffset == static_cast<int>(mImage->getGrid()->getDataSize());
}
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned n) const
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned) const
{
return {};
}
@ -32,7 +32,7 @@ std::optional<unsigned char> ImageBitStream::readNextByte()
return {};
}
void ImageBitStream::writeByte(unsigned char data, bool checkOverflow )
void ImageBitStream::writeByte(unsigned char, bool )
{
mByteOffset++;

View file

@ -17,7 +17,7 @@ public:
void writeByte(unsigned char data, bool checkOverflow = true) override;
void writeBytes(const std::vector<unsigned char> data) override
void writeBytes(const std::vector<unsigned char>) override
{
}

View file

@ -34,7 +34,7 @@ IFontEngine* FontsManager::getFontEngine() const
return mFontEngine.get();
}
FontGlyph* FontsManager::getGlyph(const std::string& fontFace, float size, uint32_t c)
FontGlyph* FontsManager::getGlyph(const std::string&, float size, uint32_t c)
{
auto path = std::filesystem::path("truetype/liberation/LiberationSans-Regular.ttf");

View file

@ -15,7 +15,7 @@ std::unique_ptr<DrawingSurface> DrawingSurface::Create()
return std::make_unique<DrawingSurface>();
}
void DrawingSurface::setSize(unsigned width, unsigned height, bool triggerResize)
void DrawingSurface::setSize(unsigned width, unsigned height, bool)
{
mWidth = width;
mHeight = height;

View file

@ -1,6 +1,6 @@
#include "AbstractMesh.h"
void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const std::vector<double>& values)
void AbstractMesh::addConstantNodeVectorAttribute(const std::string&, const std::vector<double>&)
{
}
@ -10,7 +10,7 @@ AbstractMesh::~AbstractMesh()
}
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag)
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string&)
{
std::vector<std::vector<double> > attribs(mNodes.size());
return attribs;

View file

@ -101,7 +101,7 @@ std::unique_ptr<LineMesh> MeshPrimitives::buildCircleAsLineMesh(std::size_t numS
return MeshBuilder::buildLineMesh(locations, edge_ids);
}
std::unique_ptr<TriMesh> MeshPrimitives::buildRoundedRectangleAsTriMesh(double radius, double aspect_ratio, std::size_t num_segments)
std::unique_ptr<TriMesh> MeshPrimitives::buildRoundedRectangleAsTriMesh(double radius, double, std::size_t num_segments)
{
std::size_t num_fans = 4;
std::size_t num_nodes_per_fan = num_segments + 2;

View file

@ -29,7 +29,7 @@ std::size_t AbstractVisualNode::getNumSceneItems() const
return mSceneItems.size();
}
void AbstractVisualNode::update(SceneInfo* sceneInfo)
void AbstractVisualNode::update(SceneInfo*)
{
}

View file

@ -76,7 +76,7 @@ std::size_t GridNode::getNumSceneItems() const
return 2;
}
void GridNode::update(SceneInfo* sceneInfo)
void GridNode::update(SceneInfo*)
{
if (!mBackgroundModel || mDataDirty)
{

View file

@ -14,7 +14,7 @@ MeshNode::~MeshNode()
}
SceneItem* MeshNode::getSceneItem(std::size_t idx) const
SceneItem* MeshNode::getSceneItem(std::size_t) const
{
return mModel.get();
}
@ -55,7 +55,7 @@ void MeshNode::setMesh(AbstractMesh* mesh)
mMeshIsDirty = true;
}
void MeshNode::update(SceneInfo* sceneInfo)
void MeshNode::update(SceneInfo*)
{
if (!mModel || mMeshIsDirty)
{

View file

@ -86,7 +86,7 @@ void Scene::setShowMeshOutline(bool shouldShow)
mSceneInfo->mShowMeshOutline = shouldShow;
}
void Scene::setSupportsGeometryPrimitives(bool supports)
void Scene::setSupportsGeometryPrimitives(bool)
{
mSceneInfo->mSupportsGeometryPrimitives = true;
}

View file

@ -31,7 +31,7 @@ unsigned SvgNode::getContentHeight() const
return mContentHeight;
}
void SvgNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
void SvgNode::createOrUpdateGeometry(SceneInfo*)
{
if (!mContent->getRoot())
{

View file

@ -16,7 +16,7 @@ TopBar::TopBar()
fileButton->setMargin(2);
fileButton->setMaxWidth(60);
auto onClick = [this](Widget* self){
auto onClick = [this](Widget*){
auto menu = std::make_unique<TopBarMenu>();
auto window = getTopLevelWindow();
window->addPopup(std::move(menu));

View file

@ -7,7 +7,7 @@
class TopBarMenu : public Widget
{
public:
void popupFrom(Widget* parent)
void popupFrom(Widget*)
{

View file

@ -10,12 +10,12 @@ std::unique_ptr<Keyboard> Keyboard::Create()
return std::make_unique<Keyboard>();
}
std::string Keyboard::getKeyString(KeyCode code)
std::string Keyboard::getKeyString(KeyCode)
{
return "";
}
Keyboard::Function Keyboard::getFunction(KeyCode code)
Keyboard::Function Keyboard::getFunction(KeyCode)
{
return Function::UNSET;
}

View file

@ -48,17 +48,17 @@ unsigned FontTokens::getSize(Theme::Sys::Typescale typescale)
}
}
unsigned FontTokens::getTracking(Theme::Sys::Typescale typescale)
unsigned FontTokens::getTracking(Theme::Sys::Typescale)
{
return 0;
}
unsigned FontTokens::getWeight(Theme::Ref::Typeface::Font font)
unsigned FontTokens::getWeight(Theme::Ref::Typeface::Font)
{
return 0;
}
Theme::Ref::Typeface::Font FontTokens::getWeight(Theme::Sys::Typescale typescale)
Theme::Ref::Typeface::Font FontTokens::getWeight(Theme::Sys::Typescale)
{
return Theme::Ref::Typeface::Font::Brand;
}

View file

@ -243,7 +243,7 @@ bool Widget::onKeyboardEvent(const KeyboardEvent* event)
return true;
}
bool Widget::onMyKeyboardEvent(const KeyboardEvent* event)
bool Widget::onMyKeyboardEvent(const KeyboardEvent*)
{
return false;
}
@ -306,7 +306,7 @@ void Widget::setFocus(bool hasFocus)
}
}
void Widget::onMyMouseEvent(const MouseEvent* event)
void Widget::onMyMouseEvent(const MouseEvent*)
{
}

View file

@ -17,9 +17,9 @@ public:
void loop() override{};
void showWindow(mt::Window* window) override{};
void showWindow(mt::Window*) override{};
void addWindow(mt::Window* window) override{};
void addWindow(mt::Window*) override{};
protected:
void initialize() override{};

View file

@ -73,7 +73,7 @@ bool XcbGlWindowInterface::initialize(xcb_window_t window)
return true;
}
void XcbGlWindowInterface::resizeViewPort(unsigned width, unsigned height)
void XcbGlWindowInterface::resizeViewPort(unsigned, unsigned)
{
//glViewport(0, 0, width, height);
//glScissor(0, 0, width, height);

View file

@ -190,7 +190,7 @@ void XcbInterface::onPaint()
mainWindow->doPaint(defaultScreen);
}
void XcbInterface::onExposeEvent(xcb_expose_event_t* event)
void XcbInterface::onExposeEvent(xcb_expose_event_t*)
{
//auto window = mWindows[event->window];
//window->SetSize(event->width, event->height);

View file

@ -30,7 +30,7 @@ XcbWindow::~XcbWindow()
xcb_destroy_window(mConnection, mHandle);
}
void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, FontsManager* fontsManager, XcbGlInterface* xcbGlInterface)
void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen* screen, uint32_t eventMask, FontsManager*, XcbGlInterface* xcbGlInterface)
{
if (!screen)
{

View file

@ -15,7 +15,7 @@ public:
return Type::TEXT_RUN;
}
std::string toString(unsigned depth = 0, bool keepInline = false) const override
std::string toString(unsigned, bool) const override
{
return getText();

View file

@ -1,6 +1,6 @@
#include "HtmlParagraphElement.h"
std::string HtmlParagraphElement::toString(unsigned depth, bool keepInline) const
std::string HtmlParagraphElement::toString(unsigned depth, bool) const
{
const auto prefix = std::string(2*depth, ' ');

View file

@ -30,7 +30,7 @@ public:
virtual Type getType() const = 0;
virtual void doFieldSubstitution(Type elementType, const std::string& searchPhrase, const std::string& replacementPhrase)
virtual void doFieldSubstitution(Type, const std::string&, const std::string&)
{
}