cmake+ci: run clang-tidy (#512)

* cmake+ci: run clang-tidy

* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def

* Add initial .clang-tidy and fixes

* fix file perms

* Comment out DESCRIPTION

* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def

* Looks like clang is allergic to the libs in the directx5 SDK

* Update .clang-tidy

* Fix typo in .clang-tidy

* Attempt to generate an action error

* Revert "Attempt to generate an action error"

This reverts commit 96c4c65fed.

* cmake: test with -Wparentheses + optionally with -Werror

* ci: -k0 is a Ninja argument

* Use -Werror only for msys2 builds

* cmake: only emit warnings for specific warnings

* cmake: and don't do -Werror/-WX anymore

* Fix warnings

* Fix mingw warnings

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Anonymous Maarten
2024-02-01 21:42:10 +01:00
committed by GitHub
parent 97d1ba7c71
commit 9e686e2a87
308 changed files with 2863 additions and 1995 deletions

View File

@@ -29,8 +29,9 @@ Lego3DView::~Lego3DView()
BOOL Lego3DView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
{
double viewAngle = 45;
if (rCreateStruct.m_isWideViewAngle)
if (rCreateStruct.m_isWideViewAngle) {
viewAngle = 90;
}
float frontClippingDistance = 0.1;
float backClippingDistance = 500;

View File

@@ -13,10 +13,10 @@
class Lego3DView : public LegoView1 {
public:
Lego3DView();
virtual ~Lego3DView() override;
~Lego3DView() override;
BOOL Create(const CreateStruct&, Tgl::Renderer*);
virtual void Destroy() override; // vtable+0x08
void Destroy() override; // vtable+0x08
BOOL Add(ViewROI&);
BOOL Remove(ViewROI&);

View File

@@ -42,8 +42,9 @@ LegoView::~LegoView()
BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Renderer* pRenderer)
{
float viewAngle = 45;
if (rCreateStruct.m_isWideViewAngle)
if (rCreateStruct.m_isWideViewAngle) {
viewAngle = 90;
}
float frontClippingDistance = 0.1;
float backClippingDistance = 500;

View File

@@ -18,16 +18,16 @@ class Camera;
class LegoView : public TglSurface {
public:
LegoView();
virtual ~LegoView() override;
~LegoView() override;
BOOL Create(const CreateStruct&, Tgl::Renderer*);
virtual void Destroy() override; // vtable+0x08
void Destroy() override; // vtable+0x08
Tgl::Group* GetScene() const;
Tgl::Camera* GetCamera() const;
protected:
virtual Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*); // vtable+0x10
Tgl::View* CreateView(Tgl::Renderer*, Tgl::Device*) override; // vtable+0x10
private:
Tgl::Group* m_pScene; // 0x70
@@ -58,11 +58,11 @@ inline Tgl::Camera* LegoView::GetCamera() const
class LegoView1 : public LegoView {
public:
LegoView1();
virtual ~LegoView1() override;
~LegoView1() override;
BOOL AddLightsToViewport();
BOOL Create(const TglSurface::CreateStruct&, Tgl::Renderer*);
virtual void Destroy() override; // vtable+0x08
void Destroy() override; // vtable+0x08
private:
Tgl::Light* m_pSunLight; // 0x78

View File

@@ -109,14 +109,17 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
strcat(mode, "r");
}
if (p_mode & c_write) {
if (m_mode != c_read)
if (m_mode != c_read) {
m_mode = c_write;
}
strcat(mode, "w");
}
if ((p_mode & c_text) != 0)
if ((p_mode & c_text) != 0) {
strcat(mode, "t");
else
}
else {
strcat(mode, "b");
}
if (!(m_file = fopen(p_name, mode))) {
return FAILURE;

View File

@@ -44,10 +44,10 @@ protected:
class LegoMemory : public LegoStorage {
public:
LegoMemory(void* p_buffer);
virtual LegoResult Read(void* p_buffer, LegoU32 p_size);
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size);
virtual LegoResult GetPosition(LegoU32& p_position);
virtual LegoResult SetPosition(LegoU32 p_position);
LegoResult Read(void* p_buffer, LegoU32 p_size) override;
LegoResult Write(const void* p_buffer, LegoU32 p_size) override;
LegoResult GetPosition(LegoU32& p_position) override;
LegoResult SetPosition(LegoU32 p_position) override;
// SYNTHETIC: LEGO1 0x10045a80
// LegoMemory::~LegoMemory
@@ -65,11 +65,11 @@ protected:
class LegoFile : public LegoStorage {
public:
LegoFile();
virtual ~LegoFile() override;
virtual LegoResult Read(void* p_buffer, LegoU32 p_size);
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size);
virtual LegoResult GetPosition(LegoU32& p_position);
virtual LegoResult SetPosition(LegoU32 p_position);
~LegoFile() override;
LegoResult Read(void* p_buffer, LegoU32 p_size) override;
LegoResult Write(const void* p_buffer, LegoU32 p_size) override;
LegoResult GetPosition(LegoU32& p_position) override;
LegoResult SetPosition(LegoU32 p_position) override;
LegoResult Open(const char* p_name, LegoU32 p_mode);
// FUNCTION: LEGO1 0x10006030

View File

@@ -75,13 +75,15 @@ unsigned char LegoROI::CallTheHandlerFunction(
)
{
// TODO
if (p_param == NULL)
if (p_param == NULL) {
return FALSE;
}
if (g_someHandlerFunction) {
char buf[32];
if (g_someHandlerFunction(p_param, buf, 32))
if (g_someHandlerFunction(p_param, buf, 32)) {
p_param = buf;
}
}
return ColorAliasLookup(p_param, p_red, p_green, p_blue, p_other);

View File

@@ -19,9 +19,9 @@ class LegoROI : public ViewROI {
public:
LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, int p_time);
virtual float IntrinsicImportance() const override; // vtable+0x04
float IntrinsicImportance() const override; // vtable+0x04
// Note: Actually part of parent class (doesn't exist yet)
virtual void UpdateWorldBoundingVolumes() override; // vtable+0x18
void UpdateWorldBoundingVolumes() override; // vtable+0x18
void SetDisplayBB(int p_displayBB);
static void configureLegoROI(int p_roi);