mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-09 03:59:34 -04:00
Fix JUT_ASSERT and several other macros (#2711)
* Fix JUT_ASSERT to be a nested define * Switch names that appear in asserts to be constants instead of defines * Replace `0` in asserts with `NULL` or `FALSE` * Fix fpclassify * Fix ARRAY_SIZE * Use G_CM3D_F_INF * More fixes for fpclassify * Remove FLOAT_LABEL * Remove incorrect FLAG_ON macro * Remove UNK_BSS macro * Silence clangd unused header warning for PCH
This commit is contained in:
@@ -19,7 +19,7 @@ public:
|
||||
bool isSoundAttached() const { return sound_ != NULL; }
|
||||
|
||||
JAISound* operator->() const {
|
||||
JUT_ASSERT(58, sound_ != 0);
|
||||
JUT_ASSERT(58, sound_ != NULL);
|
||||
return sound_;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
JASGlobalInstance(bool param_1) {
|
||||
if (param_1) {
|
||||
JUT_ASSERT(186, sInstance == 0);
|
||||
JUT_ASSERT(186, sInstance == NULL);
|
||||
sInstance = (T*)this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ namespace JASDsp {
|
||||
extern const u32 FILTER_MODE_IIR;
|
||||
};
|
||||
|
||||
#define MAX_CHILDREN 16
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
@@ -126,6 +124,8 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
static JASDefaultBankTable sDefaultBankTable;
|
||||
static TList sTrackList;
|
||||
|
||||
static const int MAX_CHILDREN = 16;
|
||||
|
||||
JASSeqCtrl* getSeqCtrl() { return &mSeqCtrl; }
|
||||
u16 getPort(u32 param_0) const { return mTrackPort.get(param_0); }
|
||||
void setPort(u32 param_0, u16 param_1) { mTrackPort.set(param_0, param_1); }
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
JASHeap* heap = &mHeaps[0]; // should probably be mHeaps[i] but that doesn't match
|
||||
heap->free();
|
||||
if (!heap) {
|
||||
JUT_ASSERT(47, 0);
|
||||
JUT_ASSERT(47, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,19 +191,19 @@ struct TLinkList : public TNodeLinkList {
|
||||
};
|
||||
|
||||
static TLinkListNode* Element_toNode(T* p) {
|
||||
JUT_ASSERT(0x2F1, p!=0);
|
||||
JUT_ASSERT(0x2F1, p!=NULL);
|
||||
return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(p) - I);
|
||||
}
|
||||
static const TLinkListNode* Element_toNode(const T* p) {
|
||||
JUT_ASSERT(0x2F6, p!=0);
|
||||
JUT_ASSERT(0x2F6, p!=NULL);
|
||||
return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(p) - I);
|
||||
}
|
||||
static T* Element_toValue(TLinkListNode* p) {
|
||||
JUT_ASSERT(0x2FB, p!=0);
|
||||
JUT_ASSERT(0x2FB, p!=NULL);
|
||||
return reinterpret_cast<T*>(reinterpret_cast<char*>(p) + I);
|
||||
}
|
||||
static const T* Element_toValue(const TLinkListNode* p) {
|
||||
JUT_ASSERT(0x300, p!=0);
|
||||
JUT_ASSERT(0x300, p!=NULL);
|
||||
return reinterpret_cast<const T*>(reinterpret_cast<const char*>(p) + I);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ struct TExpandStride_<s32> {
|
||||
//! Target: toValueFromIndex<PFdd_d>__7JGadgetFiPCPFdd_dUlRCPFdd_d_RCPFdd_d
|
||||
template <typename T>
|
||||
inline const T& toValueFromIndex(int idx, const T* pValue, u32 count, const T& fallback) {
|
||||
JUT_ASSERT(200, pValue!=0);
|
||||
JUT_ASSERT(200, pValue!=NULL);
|
||||
u32 index = idx;
|
||||
if (index >= count) {
|
||||
return fallback;
|
||||
|
||||
@@ -23,7 +23,7 @@ struct TAllocator {
|
||||
}
|
||||
|
||||
void destroy(T* p) {
|
||||
JUT_ASSERT(68, p!=0);
|
||||
JUT_ASSERT(68, p!=NULL);
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 mAllocator;
|
||||
|
||||
@@ -125,7 +125,7 @@ struct TVector {
|
||||
u32 capacity() { return mCapacity; }
|
||||
|
||||
u32 GetSize_extend_(u32 count) {
|
||||
JUT_ASSERT(0x22B, pfnExtend_!=0);
|
||||
JUT_ASSERT(0x22B, pfnExtend_!=NULL);
|
||||
|
||||
u32 oldSize = size();
|
||||
u32 neededNewSpace = oldSize + count;
|
||||
|
||||
@@ -56,12 +56,12 @@ public:
|
||||
void releaseMCTX(JORMContext*);
|
||||
|
||||
void appendEventCallbackListNode(JOREventCallbackListNode* p) {
|
||||
JUT_ASSERT(256, p!=0);
|
||||
JUT_ASSERT(256, p!=NULL);
|
||||
m_eventCallbackList.Push_front(p);
|
||||
}
|
||||
|
||||
void removeEventCallbackListNode(JOREventCallbackListNode* p) {
|
||||
JUT_ASSERT(257, p!=0);
|
||||
JUT_ASSERT(257, p!=NULL);
|
||||
m_eventCallbackList.Remove(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,12 +202,12 @@ public:
|
||||
|
||||
static JKRCompression convertAttrToCompressionType(u32 attr) {
|
||||
#define JKRARCHIVE_ATTR_COMPRESSION 0x04
|
||||
#define JKRARCHIVE_ATTR_YAY0 0x80
|
||||
#define JKRARCHIVE_ATTR_YAZ0 0x80
|
||||
|
||||
JKRCompression compression;
|
||||
if (FLAG_ON(attr, JKRARCHIVE_ATTR_COMPRESSION)) {
|
||||
if (!(attr & JKRARCHIVE_ATTR_COMPRESSION)) {
|
||||
compression = COMPRESSION_NONE;
|
||||
} else if (!FLAG_ON(attr, JKRARCHIVE_ATTR_YAY0)) {
|
||||
} else if (attr & JKRARCHIVE_ATTR_YAZ0) {
|
||||
compression = COMPRESSION_YAZ0;
|
||||
} else {
|
||||
compression = COMPRESSION_YAY0;
|
||||
|
||||
@@ -36,8 +36,8 @@ struct TControl {
|
||||
}
|
||||
|
||||
int setMessageCode_inReset_(const TProcessor* pProcessor, u16 u16GroupID, u16 u16Index) {
|
||||
JUT_ASSERT(138, pEntry_==0);
|
||||
JUT_ASSERT(139, pszText_update_current_==0);
|
||||
JUT_ASSERT(138, pEntry_==NULL);
|
||||
JUT_ASSERT(139, pszText_update_current_==NULL);
|
||||
JUT_ASSERT(140, oStack_renderingProcessor_.empty());
|
||||
|
||||
if (!setMessageCode_inSequence_(pProcessor, u16GroupID, u16Index)) {
|
||||
|
||||
@@ -20,7 +20,7 @@ struct TReference {
|
||||
/* 802A7B40 */ virtual const char* do_word(u32) const;
|
||||
|
||||
int on_parseCharacter(const char** ppszText) const {
|
||||
JUT_ASSERT(97, pcResource_!=0);
|
||||
JUT_ASSERT(97, pcResource_!=NULL);
|
||||
return pcResource_->parseCharacter(ppszText);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ struct TProcessor {
|
||||
pResourceCache_(NULL),
|
||||
pszCurrent_(NULL)
|
||||
{
|
||||
JUT_ASSERT(584, pReference_!=0);
|
||||
JUT_ASSERT(584, pReference_!=NULL);
|
||||
}
|
||||
|
||||
typedef bool (*pfnProcess_func)(TProcessor*);
|
||||
@@ -175,7 +175,7 @@ struct TProcessor {
|
||||
void on_character(int iCharacter) { do_character(iCharacter); }
|
||||
|
||||
const char* on_message_limited(u16 u16Index) const {
|
||||
JUT_ASSERT(482, pResourceCache_!=0);
|
||||
JUT_ASSERT(482, pResourceCache_!=NULL);
|
||||
return pResourceCache_->getMessageText_messageIndex(u16Index);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ struct TProcessor {
|
||||
}
|
||||
|
||||
int setBegin_messageEntryText(const TProcessor* pProcessor, const void* pEntry, const char* pszText) {
|
||||
JUT_ASSERT(306, pProcessor!=0);
|
||||
JUT_ASSERT(306, pProcessor!=NULL);
|
||||
setBegin_messageEntryText(pProcessor->getResourceCache(), pEntry, pszText);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ struct TResource {
|
||||
}
|
||||
|
||||
char* getMessageText_messageEntry(const void* pEntry) const {
|
||||
JUT_ASSERT(141, pEntry!=0);
|
||||
JUT_ASSERT(141, pEntry!=NULL);
|
||||
return pMessageText_ + *(int*)pEntry;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ struct TResourceContainer {
|
||||
/* 802A90F0 */ void setEncoding_(u8 e);
|
||||
|
||||
int parseCharacter(const char** ppszText) const {
|
||||
JUT_ASSERT(330, pfnParseCharacter_!=0);
|
||||
JUT_ASSERT(330, pfnParseCharacter_!=NULL);
|
||||
return pfnParseCharacter_(ppszText);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ctb {
|
||||
struct TObject : public object::TObject_ID {
|
||||
TObject(const void* id, u32 size, const void* param_2) : object::TObject_ID(id, size) {
|
||||
pData_ = param_2;
|
||||
JUT_ASSERT(82, pData_!=0);
|
||||
JUT_ASSERT(82, pData_!=NULL);
|
||||
}
|
||||
/* 80280F18 */ virtual ~TObject() = 0;
|
||||
virtual int getScheme() const = 0;
|
||||
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
|
||||
f32 operator*() {
|
||||
#ifdef DEBUG
|
||||
JUT_ASSERT(947, pf_!=0);
|
||||
JUT_ASSERT(947, pf_!=NULL);
|
||||
#endif
|
||||
return *pf_;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
|
||||
f32 operator*() {
|
||||
#ifdef DEBUG
|
||||
JUT_ASSERT(1098, pf_!=0);
|
||||
JUT_ASSERT(1098, pf_!=NULL);
|
||||
#endif
|
||||
return *pf_;
|
||||
}
|
||||
|
||||
@@ -123,13 +123,13 @@ public:
|
||||
CMtxP transformOnSet_getMatrix() const { return mTransformOnSet_Matrix; }
|
||||
|
||||
void transformOnSet_transformTranslation(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(226, pDst!=0);
|
||||
JUT_ASSERT(226, pDst!=NULL);
|
||||
JUT_ASSERT(227, &rSrc!=pDst);
|
||||
MTXMultVec(transformOnSet_getMatrix(), &rSrc, pDst);
|
||||
}
|
||||
|
||||
void transformOnSet_transformRotation(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(232, pDst!=0);
|
||||
JUT_ASSERT(232, pDst!=NULL);
|
||||
JUT_ASSERT(233, &rSrc!=pDst);
|
||||
pDst->x = rSrc.x;
|
||||
pDst->y = rSrc.y + mTransformOnSet_RotationY;
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
}
|
||||
|
||||
void transformOnSet_transformScaling(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(240, pDst!=0);
|
||||
JUT_ASSERT(240, pDst!=NULL);
|
||||
JUT_ASSERT(241, &rSrc!=pDst);
|
||||
*pDst = rSrc;
|
||||
}
|
||||
@@ -176,20 +176,20 @@ public:
|
||||
CMtxP transformOnGet_getMatrix() const { return mTransformOnGet_Matrix; }
|
||||
|
||||
void transformOnGet_transformTranslation(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(296, pDst!=0);
|
||||
JUT_ASSERT(296, pDst!=NULL);
|
||||
JUT_ASSERT(297, &rSrc!=pDst);
|
||||
MTXMultVec(transformOnGet_getMatrix(), &rSrc, pDst);
|
||||
}
|
||||
|
||||
void transformOnGet_transformDirection(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(316, pDst!=0);
|
||||
JUT_ASSERT(316, pDst!=NULL);
|
||||
JUT_ASSERT(317, &rSrc!=pDst);
|
||||
MTXMultVecSR(transformOnGet_getMatrix(), &rSrc, pDst);
|
||||
}
|
||||
|
||||
void transformOnGet_transform(TTransform_position_direction* param_1,
|
||||
TTransform_position_direction* pDst) const {
|
||||
JUT_ASSERT(289, pDst!=0);
|
||||
JUT_ASSERT(289, pDst!=NULL);
|
||||
transformOnGet_transformTranslation(param_1->position, &pDst->position);
|
||||
transformOnGet_transformDirection(param_1->direction, &pDst->direction);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
}
|
||||
|
||||
void transformOnGet_transformRotation(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(302, pDst!=0);
|
||||
JUT_ASSERT(302, pDst!=NULL);
|
||||
JUT_ASSERT(303, &rSrc!=pDst);
|
||||
pDst->x = rSrc.x;
|
||||
pDst->y = rSrc.y + mTransformOnGet_RotationY;
|
||||
@@ -228,14 +228,14 @@ public:
|
||||
}
|
||||
|
||||
void transformOnGet_transformScaling(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(310, pDst!=0);
|
||||
JUT_ASSERT(310, pDst!=NULL);
|
||||
JUT_ASSERT(311, &rSrc!=pDst);
|
||||
*pDst = rSrc;
|
||||
}
|
||||
|
||||
void transformOnGet_transform(TTransform_translation_rotation_scaling* param_1,
|
||||
TTransform_translation_rotation_scaling* pDst) const {
|
||||
JUT_ASSERT(263, pDst!=0);
|
||||
JUT_ASSERT(263, pDst!=NULL);
|
||||
transformOnGet_transformTranslation(param_1->translation, &pDst->translation);
|
||||
transformOnGet_transformRotation(param_1->rotation, &pDst->rotation);
|
||||
transformOnGet_transformScaling(param_1->scaling, &pDst->scaling);
|
||||
@@ -252,14 +252,14 @@ public:
|
||||
}
|
||||
|
||||
void transformOnSet_transformDirection(const Vec& rSrc, Vec* pDst) const {
|
||||
JUT_ASSERT(246, pDst!=0);
|
||||
JUT_ASSERT(246, pDst!=NULL);
|
||||
JUT_ASSERT(247, &rSrc!=pDst);
|
||||
MTXMultVecSR(transformOnSet_getMatrix(), &rSrc, pDst);
|
||||
}
|
||||
|
||||
void transformOnSet_transform(TTransform_position_direction* param_1,
|
||||
TTransform_position_direction* pDst) const {
|
||||
JUT_ASSERT(219, pDst!=0);
|
||||
JUT_ASSERT(219, pDst!=NULL);
|
||||
transformOnSet_transformTranslation(param_1->position, &pDst->position);
|
||||
transformOnSet_transformDirection(param_1->direction, &pDst->direction);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ struct TCreateObject : public JStudio::TCreateObject {
|
||||
pJAISoundStarter_ = p_soundStarter;
|
||||
pJSGSystem_ = p_system;
|
||||
mPermit_onExit_notEnd = false;
|
||||
JUT_ASSERT(45, pJAISoundStarter_!=0);
|
||||
JUT_ASSERT(45, pJAISoundStarter_!=NULL);
|
||||
}
|
||||
|
||||
/* 8028D550 */ virtual ~TCreateObject();
|
||||
|
||||
@@ -14,7 +14,7 @@ struct TCreateObject : public JStudio::TCreateObject {
|
||||
pJPAEmitterManager_ = p_emitMgr;
|
||||
pJSGSystem_ = p_system;
|
||||
mPermit_onExit_notEnd = false;
|
||||
JUT_ASSERT(48, pJPAEmitterManager_!=0);
|
||||
JUT_ASSERT(48, pJPAEmitterManager_!=NULL);
|
||||
}
|
||||
|
||||
/* 8028E3A0 */ virtual ~TCreateObject();
|
||||
@@ -42,7 +42,7 @@ struct TAdaptor_particle : public JStudio::TAdaptor_particle {
|
||||
TJPACallback_emitter_(TAdaptor_particle* param_1) {
|
||||
pThis_ = param_1;
|
||||
pOld = NULL;
|
||||
JUT_ASSERT(113, pThis_!=0);
|
||||
JUT_ASSERT(113, pThis_!=NULL);
|
||||
}
|
||||
/* 8028ECC0 */ virtual void execute(JPABaseEmitter*);
|
||||
/* 8028F060 */ virtual void executeAfter(JPABaseEmitter*);
|
||||
|
||||
@@ -17,7 +17,7 @@ typedef JStudio::TObject* (*ObjCreateFuncT)(const JStudio::stb::data::TParse_TBl
|
||||
struct TCreateObject : public JStudio::TCreateObject {
|
||||
TCreateObject(const JStage::TSystem* pSystem) {
|
||||
pJSGSystem_ = pSystem;
|
||||
JUT_ASSERT(42, pJSGSystem_!=0);
|
||||
JUT_ASSERT(42, pJSGSystem_!=NULL);
|
||||
}
|
||||
|
||||
/* 80289B00 */ virtual ~TCreateObject();
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define JUT_SHOW_ASSERT(LINE, COND) JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND)
|
||||
|
||||
#define JUT_ASSERT(LINE, COND) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND), OSPanic(__FILE__, LINE, "Halt"));
|
||||
(COND) ? (void)0 : (JUT_SHOW_ASSERT(LINE, COND), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
|
||||
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, MSG), OSPanic(__FILE__, LINE, "Halt"));
|
||||
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
initialize_state();
|
||||
}
|
||||
|
||||
static IsLeadByte_func const saoAboutEncoding_[3];
|
||||
static const int suAboutEncoding_ = 3;
|
||||
static IsLeadByte_func const saoAboutEncoding_[suAboutEncoding_];
|
||||
|
||||
// some types uncertain, may need to be fixed
|
||||
/* 0x1C */ int mWidth;
|
||||
|
||||
Reference in New Issue
Block a user