summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2024-12-02 09:40:49 +0000
committerGitHub <noreply@github.com>2024-12-02 04:40:49 -0500
commit3f703a39d91b0f90a273ca24fedfc7e6578ad363 (patch)
tree43437f65da1a62794a87e29d28a9bf4df5e2c6b5 /include
parent6199634ffb42872d053abb1502eb80474de4ae56 (diff)
Fix some more GCC warnings, mark some bugs based on GCC warnings (#2309)
* Fix some more GCC warnings, mark some bugs based on GCC warnings * Weird formatting * Suggested changes * More weird indentation I guess * UNREACHABLE() macro, add missing NORETURNs to fault_n64.c * AVOID_UB for PAL path in z_file_nameset.c * Remove comments about return types * Remove temp no longer needed
Diffstat (limited to 'include')
-rw-r--r--include/attributes.h15
-rw-r--r--include/cic6105.h2
-rw-r--r--include/ultra64/viint.h30
-rw-r--r--include/z64view.h2
4 files changed, 33 insertions, 16 deletions
diff --git a/include/attributes.h b/include/attributes.h
index 0bee9c40c..c3154cac7 100644
--- a/include/attributes.h
+++ b/include/attributes.h
@@ -1,6 +1,8 @@
#ifndef ATTRIBUTES_H
#define ATTRIBUTES_H
+#include "versions.h"
+
#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif
@@ -11,4 +13,17 @@
#define NO_REORDER __attribute__((no_reorder))
#define SECTION_DATA __attribute__((section(".data")))
+#ifdef __GNUC__
+#define UNREACHABLE() __builtin_unreachable()
+#else
+#define UNREACHABLE()
+#endif
+
+// Variables may be unused in retail versions but used in debug versions
+#if DEBUG_FEATURES
+#define UNUSED_NDEBUG
+#else
+#define UNUSED_NDEBUG UNUSED
+#endif
+
#endif
diff --git a/include/cic6105.h b/include/cic6105.h
index 43ffcc4f9..c4983db8f 100644
--- a/include/cic6105.h
+++ b/include/cic6105.h
@@ -3,7 +3,7 @@
#include "ultra64.h"
-extern s32 B_80008EE0;
+extern u32 B_80008EE0;
void func_800014E8(void);
void CIC6105_AddFaultClient(void);
diff --git a/include/ultra64/viint.h b/include/ultra64/viint.h
index 4fea2259a..6fbdb023d 100644
--- a/include/ultra64/viint.h
+++ b/include/ultra64/viint.h
@@ -17,21 +17,23 @@
// For use in initializing OSViMode structures
#define BURST(hsync_width, color_width, vsync_width, color_start) \
- (hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20))
-#define WIDTH(v) v
-#define VSYNC(v) v
-#define HSYNC(duration, leap) (duration | (leap << 16))
-#define LEAP(upper, lower) ((upper << 16) | lower)
-#define START(start, end) ((start << 16) | end)
-
-#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1))
-
+ ((((u8)(hsync_width) & 0xFF) << 0) | \
+ (((u8)(color_width) & 0xFF) << 8) | \
+ (((u8)(vsync_width) & 0xF) << 16) | \
+ (((u16)(color_start) & 0xFFF) << 20))
+#define WIDTH(v) (v)
+#define VSYNC(v) (v)
+#define HSYNC(duration, leap) (((u16)(leap) << 16) | (u16)(duration))
+#define LEAP(upper, lower) (((u16)(upper) << 16) | (u16)(lower))
+#define START(start, end) (((u16)(start) << 16) | (u16)(end))
+
+#define FTOFIX(val, i, f) ((u32)((val) * (f32)(1 << (f))) & ((1 << ((i) + (f))) - 1))
#define F210(val) FTOFIX(val, 2, 10)
-#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16))
+#define SCALE(scaleup, off) (F210(1.0f / (f32)(scaleup)) | (F210((f32)(off)) << 16))
-#define VCURRENT(v) v
-#define ORIGIN(v) v
-#define VINTR(v) v
-#define HSTART START
+#define VCURRENT(v) (v)
+#define ORIGIN(v) (v)
+#define VINTR(v) (v)
+#define HSTART(start, end) START(start, end)
#endif
diff --git a/include/z64view.h b/include/z64view.h
index 1d7892014..3eb3755a2 100644
--- a/include/z64view.h
+++ b/include/z64view.h
@@ -81,7 +81,7 @@ void View_SetViewport(View* view, Viewport* viewport);
void View_GetViewport(View* view, Viewport* viewport);
void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
-s32 View_SetDistortionSpeed(View* view, f32 speed);
+BAD_RETURN(s32) View_SetDistortionSpeed(View* view, f32 speed);
void View_InitDistortion(View* view);
void View_ClearDistortion(View* view);
void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);