all: Fix all compiler warnings (#614)

This commit is contained in:
MonsterDruide1 2025-05-31 11:14:32 +02:00 committed by GitHub
parent 415a40cee7
commit 16c404de5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 23 additions and 12 deletions

View file

@ -47,7 +47,12 @@ LiveActorKit::~LiveActorKit() {
mCameraDirector = nullptr;
}
if (mClippingDirector) {
#pragma clang diagnostic push
// in this case, mClippingDirector has the correct type,
// causing the destructor to be called correctly
#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
delete mClippingDirector;
#pragma clang diagnostic pop
mClippingDirector = nullptr;
}
if (mModelGroup) {

View file

@ -76,7 +76,7 @@ bool printAllSequenceHeap() {
}
void createSceneHeap(const char* stageName, bool backwards) {
sead::ScopedCurrentHeapSetter heapSetter = sead::ScopedCurrentHeapSetter(getSequenceHeap());
sead::ScopedCurrentHeapSetter heapSetter{getSequenceHeap()};
SystemKit* systemKit = alProjectInterface::getSystemKit();
bool isSceneHeapCreated = systemKit->getMemorySystem()->createSceneHeap(stageName, backwards);
@ -89,7 +89,7 @@ void createSceneHeap(const char* stageName, bool backwards) {
}
void createSceneResourceHeap(const char* stageName) {
sead::ScopedCurrentHeapSetter heapSetter = sead::ScopedCurrentHeapSetter(getSequenceHeap());
sead::ScopedCurrentHeapSetter heapSetter{getSequenceHeap()};
alProjectInterface::getSystemKit()->getMemorySystem()->createSceneResourceHeap(stageName,
false);
@ -118,7 +118,7 @@ void destroySceneHeap(bool removeCategory) {
}
void createCourseSelectHeap() {
sead::ScopedCurrentHeapSetter heapSetter = sead::ScopedCurrentHeapSetter(getSequenceHeap());
sead::ScopedCurrentHeapSetter heapSetter{getSequenceHeap()};
alProjectInterface::getSystemKit()->getMemorySystem()->createCourseSelectHeap();
@ -133,7 +133,7 @@ void destroyCourseSelectHeap() {
}
void createWorldResourceHeap(bool useCategory) {
sead::ScopedCurrentHeapSetter heapSetter = sead::ScopedCurrentHeapSetter(getSequenceHeap());
sead::ScopedCurrentHeapSetter heapSetter{getSequenceHeap()};
alProjectInterface::getSystemKit()->getMemorySystem()->createWorldResourceHeap();

View file

@ -75,7 +75,7 @@ al::initNerveAction(this, "Hide", &NrvExampleUseCase.collector, 0);
#define NERVE_HOST_TYPE_IMPL(Class, Action) NERVE_HOST_TYPE_IMPL_(Class, Action, Action)
#define NERVE_MAKE(Class, Action) Class##Nrv##Action Action;
#define NERVE_MAKE(Class, Action) [[maybe_unused]] Class##Nrv##Action Action;
#define NERVES_MAKE_STRUCT(Class, ...) \
struct { \

View file

@ -112,7 +112,7 @@ void ByamlWriterStringTable::write(sead::WriteStream* stream) const {
}
void ByamlWriterStringTable::print() const {
for (auto& node : mList)
for ([[maybe_unused]] auto& _ : mList)
;
}

View file

@ -22,6 +22,9 @@ class ClippingDirector : public HioNode, public IUseExecutor {
public:
ClippingDirector(s32 maxActors, const AreaObjDirector* areaObjDirector,
const PlayerHolder* playerHolder, const SceneCameraInfo* sceneCameraInfo);
// BUG: this destructor should have been virtual.
// This means that `delete clippingDirector::IUseExecutor` (or with HioNode) will cause the
// destructor of ClippingDirector to not be called, causing a memory leak.
~ClippingDirector();
void endInit(const AreaObjDirector* areaObjDirector);

View file

@ -6,5 +6,6 @@ namespace {
NERVE_IMPL(AnagramAlphabet, Wait);
NERVE_IMPL(AnagramAlphabet, Complete);
NERVES_MAKE_STRUCT(AnagramAlphabet, Wait, Complete);
// TODO: Remove maybe_unused once this class is implemented and the nerves are used
[[maybe_unused]] NERVES_MAKE_STRUCT(AnagramAlphabet, Wait, Complete);
} // namespace

View file

@ -18,7 +18,7 @@ void HakoniwaSequence::drawMain() const {
buffer = info->handheldRenderBuffer;
mScreenCaptureExecutor->tryCaptureAndDraw(context, buffer, 0);
sead::Viewport viewport = sead::Viewport(*buffer);
sead::Viewport viewport{*buffer};
viewport.apply(context, *buffer);
buffer->bind(context);
al::setRenderBuffer(mLayoutKit, buffer);

View file

@ -5,5 +5,6 @@
namespace {
NERVE_IMPL(GameSystem, Play);
NERVES_MAKE_STRUCT(GameSystem, Play);
// TODO: Remove maybe_unused once this class is implemented and the nerves are used
[[maybe_unused]] NERVES_MAKE_STRUCT(GameSystem, Play);
} // namespace

View file

@ -232,7 +232,7 @@ def common_sead_types(c, path):
def common_void_params(c, path):
for line in c.splitlines():
if "(void)" in line:
if "(void);" in line or "(void) {" in line or "(void) const" in line:
FAIL("Function parameters should be empty instead of \"(void)\"!", line, path)
return
@ -285,15 +285,16 @@ def common_string_finder(c, path):
string_table = get_string_table()
for line in c.splitlines():
line = line.split("//")[0]
if "#include" in line:
continue
if "extern \"C\"" in line:
continue
if "__asm__" in line:
if "__asm__" in line or "asm(" in line or "asm volatile(" in line:
continue
if "asm volatile" in line:
continue
if "//" in line:
if "#pragma" in line:
continue
matches = re.findall(r'(u?".*?")', line)