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

@@ -51,7 +51,7 @@ public:
m_first = NULL;
}
virtual ~MxList() override;
~MxList() override;
void Append(T p_obj) { InsertEntry(p_obj, this->m_last, NULL); }
void Prepend(T p_obj) { InsertEntry(p_obj, NULL, this->m_first); }
@@ -121,8 +121,9 @@ public:
// TODO: Probably shouldn't exist
void NextFragment()
{
if (m_match)
if (m_match) {
m_match = m_match->GetNext();
}
}
private:
@@ -147,13 +148,15 @@ template <class T>
inline void MxList<T>::DeleteAll(MxBool p_destroy)
{
for (MxListEntry<T>* t = m_first;;) {
if (!t)
if (!t) {
break;
}
MxListEntry<T>* next = t->GetNext();
if (p_destroy)
if (p_destroy) {
this->m_customDestructor(t->GetValue());
}
delete t;
t = next;
@@ -169,15 +172,19 @@ inline MxListEntry<T>* MxList<T>::InsertEntry(T p_newobj, MxListEntry<T>* p_prev
{
MxListEntry<T>* newEntry = new MxListEntry<T>(p_newobj, p_prev, p_next);
if (p_prev)
if (p_prev) {
p_prev->SetNext(newEntry);
else
}
else {
this->m_first = newEntry;
}
if (p_next)
if (p_next) {
p_next->SetPrev(newEntry);
else
}
else {
this->m_last = newEntry;
}
this->m_count++;
return newEntry;
@@ -186,15 +193,19 @@ inline MxListEntry<T>* MxList<T>::InsertEntry(T p_newobj, MxListEntry<T>* p_prev
template <class T>
inline void MxList<T>::DeleteEntry(MxListEntry<T>* p_match)
{
if (p_match->GetPrev())
if (p_match->GetPrev()) {
p_match->GetPrev()->SetNext(p_match->GetNext());
else
}
else {
m_first = p_match->GetNext();
}
if (p_match->GetNext())
if (p_match->GetNext()) {
p_match->GetNext()->SetPrev(p_match->GetPrev());
else
}
else {
m_last = p_match->GetPrev();
}
delete p_match;
this->m_count--;
@@ -204,8 +215,9 @@ template <class T>
inline MxBool MxListCursor<T>::Find(T p_obj)
{
for (m_match = m_list->m_first; m_match && m_list->Compare(m_match->GetValue(), p_obj);
m_match = m_match->GetNext())
m_match = m_match->GetNext()) {
;
}
return m_match != NULL;
}
@@ -232,10 +244,12 @@ inline void MxListCursor<T>::Destroy()
template <class T>
inline MxBool MxListCursor<T>::Next()
{
if (!m_match)
if (!m_match) {
m_match = m_list->m_first;
else
}
else {
m_match = m_match->GetNext();
}
return m_match != NULL;
}
@@ -243,13 +257,16 @@ inline MxBool MxListCursor<T>::Next()
template <class T>
inline MxBool MxListCursor<T>::Next(T& p_obj)
{
if (!m_match)
if (!m_match) {
m_match = m_list->m_first;
else
}
else {
m_match = m_match->GetNext();
}
if (m_match)
if (m_match) {
p_obj = m_match->GetValue();
}
return m_match != NULL;
}
@@ -257,10 +274,12 @@ inline MxBool MxListCursor<T>::Next(T& p_obj)
template <class T>
inline MxBool MxListCursor<T>::Prev()
{
if (!m_match)
if (!m_match) {
m_match = m_list->m_last;
else
}
else {
m_match = m_match->GetPrev();
}
return m_match != NULL;
}
@@ -268,13 +287,16 @@ inline MxBool MxListCursor<T>::Prev()
template <class T>
inline MxBool MxListCursor<T>::Prev(T& p_obj)
{
if (!m_match)
if (!m_match) {
m_match = m_list->m_last;
else
}
else {
m_match = m_match->GetPrev();
}
if (m_match)
if (m_match) {
p_obj = m_match->GetValue();
}
return m_match != NULL;
}
@@ -282,8 +304,9 @@ inline MxBool MxListCursor<T>::Prev(T& p_obj)
template <class T>
inline MxBool MxListCursor<T>::Current(T& p_obj)
{
if (m_match)
if (m_match) {
p_obj = m_match->GetValue();
}
return m_match != NULL;
}
@@ -292,8 +315,9 @@ template <class T>
inline MxBool MxListCursor<T>::First(T& p_obj)
{
m_match = m_list->m_first;
if (m_match)
if (m_match) {
p_obj = m_match->GetValue();
}
return m_match != NULL;
}
@@ -302,8 +326,9 @@ template <class T>
inline MxBool MxListCursor<T>::Last(T& p_obj)
{
m_match = m_list->m_last;
if (m_match)
if (m_match) {
p_obj = m_match->GetValue();
}
return m_match != NULL;
}
@@ -311,15 +336,17 @@ inline MxBool MxListCursor<T>::Last(T& p_obj)
template <class T>
inline void MxListCursor<T>::SetValue(T p_obj)
{
if (m_match)
if (m_match) {
m_match->SetValue(p_obj);
}
}
template <class T>
inline void MxListCursor<T>::Prepend(T p_newobj)
{
if (m_match)
if (m_match) {
m_list->InsertEntry(p_newobj, m_match->GetPrev(), m_match);
}
}
#endif // MXLIST_H