Add clang support.

This commit is contained in:
James Grogan 2023-01-23 11:32:18 +00:00
parent 3fad113178
commit e559f9674d
27 changed files with 84 additions and 63 deletions

View file

@ -16,7 +16,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
elseif(CMAKE_COMPILER_IS_GNUCC)
#elseif(CMAKE_COMPILER_IS_GNUCC)
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")

View file

@ -36,7 +36,7 @@ void TextEditorView::initialize()
saveButton->setBackground(Theme::Sys::Color::Primary);
saveButton->setMargin(2);
auto onSave = [this](Widget* self){
if(this && mController && mTextBox)
if(mController && mTextBox)
{
mController->SetContent(mTextBox->getContent());
mController->OnSave();
@ -48,7 +48,7 @@ void TextEditorView::initialize()
clearButton->setLabel("Clear");
clearButton->setMargin(2);
auto onClear = [this](Widget* self){
if(this && mController && mTextBox)
if(mController && mTextBox)
{
mController->OnClear();
mTextBox->setContent("");
@ -60,7 +60,7 @@ void TextEditorView::initialize()
loadButton->setLabel("Load");
loadButton->setMargin(2);
auto onLoad = [this](Widget* self){
if(this && mController && mTextBox)
if(mController && mTextBox)
{
mController->OnLoad();
mTextBox->setContent(mController->GetContent());

View file

@ -0,0 +1,20 @@
# Compiler Support
## Linux
### GCC
gcc 11.3.0
### clang
```
sudo apt-get install clang
mkdir build_clang
cd build_clang
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake $PATH_TO_SOURCE
make
```
Version 14.0

View file

@ -28,7 +28,6 @@ public:
private:
std::string mLabel;
bool mValue{ false };
TerminalType mType;
Wire* mConnection{ nullptr };
};

View file

@ -6,27 +6,27 @@
class TruthTable
{
public:
using TableData = std::map<std::vector<bool>, std::vector<bool> >;
using TableData = std::map<std::vector<bool>, std::vector<bool> >;
TruthTable(std::size_t numInputColumns, std::size_t numOutputColumns)
: mNumInputColumns(numInputColumns),
mNumOutputColumns(numOutputColumns)
{
TruthTable(std::size_t numInputColumns, std::size_t numOutputColumns)
//: mNumInputColumns(numInputColumns),
// mNumOutputColumns(numOutputColumns)
{
}
}
void setTable(const TableData& data)
{
mTable = data;
}
void setTable(const TableData& data)
{
mTable = data;
}
static TruthTable getAndTruthTable();
static TruthTable getAndTruthTable();
static const TruthTable::TableData AND_TRUTH_TABLE;
static const TruthTable::TableData AND_TRUTH_TABLE;
private:
std::size_t mNumInputColumns{ 0 };
std::size_t mNumOutputColumns{ 0 };
//std::size_t mNumInputColumns{ 0 };
//std::size_t mNumOutputColumns{ 0 };
TableData mTable;
TableData mTable;
};

View file

@ -49,7 +49,6 @@ private:
void dumpNode(RawNode<CountPair>* node, unsigned depth) const;
bool mUseFixedCode{false};
bool mTableIsInitialized{false};
std::vector<unsigned char> mSymbolMapping;
HuffmanCodeLengthTable mLiteralLengthTable;

View file

@ -30,7 +30,6 @@ public:
KeyValuePairs getKeyValuePairs() const;
private:
unsigned mLineOffset{ 0 };
std::string mHeader;
std::unordered_map<std::string, std::unique_ptr<TomlTable> > mTables;
KeyValuePairs mMap;

View file

@ -25,6 +25,5 @@ public:
void writeBytes(const std::vector<unsigned char> data) override;
private:
unsigned mBufferSize{0};
std::vector<unsigned char> mBuffer;
};

View file

@ -9,6 +9,11 @@ AbstractGrid::AbstractGrid(const Bounds& bounds, std::size_t numPointsX, std::si
}
AbstractGrid::~AbstractGrid()
{
}
const Bounds& AbstractGrid::getBounds() const
{
return mBounds;

View file

@ -10,6 +10,8 @@ class AbstractGrid
public:
AbstractGrid(const Bounds& bounds, std::size_t numPointsX, std::size_t numPointsY, std::size_t numPointsZ = 1);
virtual ~AbstractGrid();
const Bounds& getBounds() const;
virtual std::size_t getDataSize() const = 0;

View file

@ -32,7 +32,7 @@ public:
this->mData->setItem(getOffset(idx, jdx, kdx), value);
}
std::size_t getDataSize() const
std::size_t getDataSize() const override
{
return this->mData->getLength();
}

View file

@ -14,7 +14,6 @@
#include <arpa/inet.h>
UnixSocketInterface::UnixSocketInterface()
: mBufferSize(1024)
{
mMessageHandler = std::make_unique<HttpMessageHandler>();
}

View file

@ -27,7 +27,6 @@ public:
private:
static constexpr unsigned BUFFER_SIZE{1024};
std::size_t mBufferSize { 0 };
std::unique_ptr<ISocketMessageHandler> mMessageHandler;
};

View file

@ -9,20 +9,22 @@ class Image;
class IImageWriter
{
public:
enum class ImgFormat
{
PNG,
UNKNOWN
};
enum class ImgFormat
{
PNG,
UNKNOWN
};
IImageWriter(ImgFormat format)
: mFormat(format)
{
IImageWriter(ImgFormat format)
: mFormat(format)
{
};
};
virtual void write(const Path& path, Image* image) = 0;
virtual ~IImageWriter() = default;
virtual void write(const Path& path, Image* image) = 0;
protected:
ImgFormat mFormat{ ImgFormat::UNKNOWN };
ImgFormat mFormat{ ImgFormat::UNKNOWN };
};

View file

@ -19,7 +19,7 @@ public:
std::string toString(PdfXRefTable* xRefTable) override;
void updateDictionary();
void updateDictionary() override;
private:
std::vector<PdfOutlinePtr> mOutlines;

View file

@ -17,7 +17,7 @@ class PdfFont : public PdfObject
public:
std::string toString(PdfXRefTable* xRefTable) override;
void updateDictionary();
void updateDictionary() override;
};
class PdfPage : public PdfObject
@ -25,11 +25,11 @@ class PdfPage : public PdfObject
public:
PdfPage(PdfPageTree* parent);
unsigned indexObjects(unsigned count);
unsigned indexObjects(unsigned count) override;
std::string toString(PdfXRefTable* xRefTable) override;
void updateDictionary();
void updateDictionary() override;
private:
unsigned mWidth{612};

View file

@ -20,7 +20,7 @@ public:
std::size_t getNumNodes() const override;
void replaceEdge(Edge* original, Edge* replacement);
void replaceEdge(Edge* original, Edge* replacement) override;
std::size_t getEdge0Id () const;
std::size_t getEdge1Id () const;

View file

@ -11,5 +11,5 @@ public:
std::unique_ptr<AbstractMesh> copy() const override;
MeshType getType() const;
MeshType getType() const override;
};

View file

@ -12,7 +12,7 @@ class LineNode : public GeometryNode
public:
LineNode(const Transform& transform, const std::vector<Point>& points);
Type getType();
Type getType() override;
private:
void createOrUpdateGeometry(SceneInfo* sceneInfo) override;

View file

@ -135,6 +135,7 @@ void TextNode::updateLines(FontsManager* fontsManager)
}
output_lines.push_back(working_line);
running_width = 0;
(void)running_width;
}
mTextData.mLines = output_lines;

View file

@ -42,6 +42,5 @@ private:
std::unique_ptr<AbstractGeometricItem> mGeometry;
bool mGeometryIsDirty{true};
bool mColorMapIsDirty{true};
bool mShowOutline{false};
};

View file

@ -120,7 +120,7 @@ void SvgPainter::setStyle(SceneModel* model, SvgShapeElement* element) const
if (!transform.isDefaultTransform())
{
element->addAttribute(std::move(toTransform(transform)));
element->addAttribute(toTransform(transform));
}
}

View file

@ -43,7 +43,7 @@ void TabbedPanelWidget::addPanel(WidgetUPtr panel, const std::string& label)
auto rawPanel = panel.get();
auto onClick = [this, rawPanel](Widget*){
if(this && rawPanel)
if(rawPanel)
{
this->getStack()->showChild(rawPanel);
}

View file

@ -17,12 +17,9 @@ TopBar::TopBar()
fileButton->setMaxWidth(60);
auto onClick = [this](Widget* self){
if(this)
{
auto menu = std::make_unique<TopBarMenu>();
auto window = getTopLevelWindow();
window->addPopup(std::move(menu));
};
auto menu = std::make_unique<TopBarMenu>();
auto window = getTopLevelWindow();
window->addPopup(std::move(menu));
};
fileButton->setOnClickFunction(onClick);
addWidget(std::move(fileButton));

View file

@ -12,8 +12,7 @@
TextBox::TextBox()
: Widget(),
mContent(),
mCaps(false)
mContent()
{
mBackground = Theme::Sys::Color::Background;
mPadding = {20, 0, 20, 0};

View file

@ -32,7 +32,6 @@ private:
std::string mContent;
std::unique_ptr<TextNode> mTextNode;
bool mContentDirty{true};
bool mCaps;
};
using TextBoxUPtr = std::unique_ptr<TextBox>;

View file

@ -47,4 +47,6 @@ class ITheme
{
public:
virtual Color getColor(Theme::Sys::Color token) const = 0;
virtual ~ITheme() = default;
};