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:
LagoLunatic
2025-09-28 16:11:07 -04:00
committed by GitHub
parent 737250d7f5
commit 6ec6fce8cb
1008 changed files with 3172 additions and 3237 deletions
+14 -14
View File
@@ -101,7 +101,7 @@ int renderingAmap_c::getDispType() const {
disp_type = 5;
break;
default:
JUT_ASSERT(0, 0);
JUT_ASSERT(0, FALSE);
break;
}
@@ -339,7 +339,7 @@ GXColor* renderingAmap_c::getLineColor(int param_0, int param_1) {
*color = borderColor1;
break;
default:
JUT_ASSERT(0, 0);
JUT_ASSERT(0, FALSE);
break;
}
} else {
@@ -360,7 +360,7 @@ const GXColor* renderingAmap_c::getDecoLineColor(int param_0, int param_1) {
const GXColor* color;
if (isDrawOutSideTrim() && field_0x38 != 2) {
JUT_ASSERT(0, m_outSideBlackLineCnt < (sizeof(colorTable) / sizeof(colorTable[0])));
JUT_ASSERT(0, m_outSideBlackLineCnt < ARRAY_SIZEU(colorTable));
color = &colorTable[m_outSideBlackLineCnt];
} else {
color = getLineColor(param_0, param_1);
@@ -430,7 +430,7 @@ int renderingAmap_c::getStayType() const {
* isDrawIconSingle2__15renderingAmap_cCFPCQ27dTres_c6data_sbbi */
bool renderingAmap_c::isDrawIconSingle2(dTres_c::data_s const* i_data, bool param_1, bool param_2,
int param_3) const {
JUT_ASSERT(0, i_data != 0);
JUT_ASSERT(0, i_data != NULL);
bool var_r31 = false;
int disp_type = getDispType();
@@ -596,7 +596,7 @@ bool renderingAmap_c::isDrawIconSingle2(dTres_c::data_s const* i_data, bool para
}
break;
default:
JUT_ASSERT(0, 0);
JUT_ASSERT(0, FALSE);
break;
}
@@ -625,7 +625,7 @@ bool dMap_c::isSpecialOutline() {
/* 8002974C-800297A8 02408C 005C+00 1/1 0/0 0/0 .text copyPalette__6dMap_cFv */
void dMap_c::copyPalette() {
JUT_ASSERT(0, m_res != 0);
JUT_ASSERT(0, m_res != NULL);
cLib_memCpy(m_res, m_res_src, sizeof(dMap_HIO_prm_res_dst_s::m_res->palette_data));
if (getStayType() == 0) {
@@ -684,7 +684,7 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) {
field_0x90 = 0;
m_res = new (0x20) dMap_prm_res_s;
JUT_ASSERT(0, m_res != 0);
JUT_ASSERT(0, m_res != NULL);
dMap_HIO_prm_res_dst_s::m_res = m_res;
@@ -700,12 +700,12 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) {
int buffer_size = GXGetTexBufferSize(param_2, param_3, 9, GX_FALSE, 0);
mImage_p = new (0x20) u8[buffer_size];
JUT_ASSERT(0, mImage_p != 0);
JUT_ASSERT(0, mImage_p != NULL);
renderingDAmap_c::init(mImage_p, mTexSizeX, mTexSizeY, mTexSizeX, mTexSizeY);
mResTIMG = new (0x20) ResTIMG;
JUT_ASSERT(0, mResTIMG != 0);
JUT_ASSERT(0, mResTIMG != NULL);
makeResTIMG(mResTIMG, mTexSizeX, mTexSizeY, mImage_p, (u8*)m_res, 0x33);
}
@@ -750,7 +750,7 @@ void dMap_c::getMapMinMaxXZ(int i_roomNo, f32* param_1, f32* param_2, f32* param
f32 sp8 = 0.0f;
dStage_FileList2_dt_c* fileList2_p = dStage_roomControl_c::getFileList2(i_roomNo);
JUT_ASSERT(0, fileList2_p != 0);
JUT_ASSERT(0, fileList2_p != NULL);
if (fileList2_p != NULL) {
dMapInfo_n::getRoomMinMaxXZ(i_roomNo, &sp14, &sp10, &spC, &sp8);
@@ -758,7 +758,7 @@ void dMap_c::getMapMinMaxXZ(int i_roomNo, f32* param_1, f32* param_2, f32* param
switch (getDispType()) {
default:
JUT_ASSERT(0, 0);
JUT_ASSERT(0, FALSE);
case 4:
case 0:
var_f0 = temp_f31;
@@ -870,7 +870,7 @@ void dMap_c::calcMapCenterXZ(int i_roomNo, f32* param_1, f32* param_2) {
/* 80029E1C-80029F84 02475C 0168+00 1/1 0/0 0/0 .text calcMapCmPerTexel__6dMap_cFiPf */
void dMap_c::calcMapCmPerTexel(int i_roomNo, f32* ip_cmPerTexel) {
JUT_ASSERT(0, i_roomNo >= 0);
JUT_ASSERT(0, ip_cmPerTexel != 0);
JUT_ASSERT(0, ip_cmPerTexel != NULL);
f32 cmPerTexel = 0.0f;
JUT_ASSERT(0, mTexSizeY != 0);
@@ -897,7 +897,7 @@ void dMap_c::calcMapCmPerTexel(int i_roomNo, f32* ip_cmPerTexel) {
f32 var_f31 = 0.0f;
stage_stag_info_class* pstag = dComIfGp_getStage()->getStagInfo();
JUT_ASSERT(0, pstag != 0);
JUT_ASSERT(0, pstag != NULL);
if (pstag != NULL) {
var_f31 = pstag->field_0x20;
@@ -1106,7 +1106,7 @@ void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) {
switch (getDispType()) {
default:
case 0:
JUT_ASSERT(0, 0);
JUT_ASSERT(0, FALSE);
break;
case 5:
field_0x8e = 2;