Skip to content

Commit 1aaedff

Browse files
committed
chore: Warn about unused results that aren't that problematic
1 parent 285bb88 commit 1aaedff

File tree

12 files changed

+30
-0
lines changed

12 files changed

+30
-0
lines changed

include/fat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ char *fatGetDefaultCwd(void);
8686
///
8787
/// @return
8888
/// Returns a string with the path.
89+
WARN_UNUSED_RESULT
8990
const char *fatGetDefaultDrive(void);
9091

9192
/// This function initializes a lookup cache on a given FAT file.

include/nds/arm9/console.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ void consoleSetWindow(PrintConsole *console, int x, int y, int width, int height
344344
///
345345
/// @return
346346
/// A read-only pointer to the console with the default values.
347+
WARN_UNUSED_RESULT
347348
const PrintConsole *consoleGetDefault(void);
348349

349350
/// Make the specified console the render target.

include/nds/arm9/dldi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ void dldiFixDriverAddresses(DLDI_INTERFACE *io);
103103
/// Load a DLDI driver from a file and set up the bus permissions.
104104
///
105105
/// This is not directly usable as a filesystem driver.
106+
WARN_UNUSED_RESULT
106107
DLDI_INTERFACE *dldiLoadFromFile(const char *path);
107108

108109
/// Free the memory used by the DLDI driver.

include/nds/arm9/dynamicArray.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ typedef struct DynamicArray
3535
///
3636
/// @return
3737
/// A pointer to the data, or NULL on error.
38+
WARN_UNUSED_RESULT
3839
void *DynamicArrayInit(DynamicArray *v, unsigned int initialSize);
3940

4041
/// Frees memory allocated by the dynamic array.
@@ -52,6 +53,7 @@ void DynamicArrayDelete(DynamicArray *v);
5253
///
5354
/// @return
5455
/// The data or NULL if v is NULL or the index is out of range.
56+
WARN_UNUSED_RESULT
5557
void *DynamicArrayGet(DynamicArray *v, unsigned int index);
5658

5759
/// Sets the entry to the supplied value.
@@ -65,6 +67,7 @@ void *DynamicArrayGet(DynamicArray *v, unsigned int index);
6567
///
6668
/// @return
6769
/// Returns false if v is NULL or there isn't enough memory, true otherwise.
70+
WARN_UNUSED_RESULT
6871
bool DynamicArraySet(DynamicArray *v, unsigned int index, void *item);
6972

7073
#ifdef __cplusplus

include/nds/arm9/keyboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ typedef enum
118118
///
119119
/// @return
120120
/// Returns a read-only pointer to the default keyboard.
121+
WARN_UNUSED_RESULT
121122
const Keyboard *keyboardGetDefault(void);
122123

123124
/// Initializes the keyboard system with the supplied keyboard.

include/nds/arm9/linkedlist.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
extern "C" {
1717
#endif
1818

19+
#include <nds/ndstypes.h>
20+
1921
/// A node of the linked list.
2022
typedef struct LinkedList
2123
{
@@ -38,6 +40,7 @@ typedef struct LinkedList
3840
/// @return
3941
/// A pointer to the new node, which is also the new front, or NULL if there
4042
/// is not enough memory.
43+
WARN_UNUSED_RESULT
4144
LinkedList *linkedlistAdd(LinkedList **front, void *data);
4245

4346
/// Removes a node from a linked list.

include/nds/arm9/ndsmotion.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
extern "C" {
2020
#endif
2121

22+
#include <nds/ndstypes.h>
23+
2224
typedef struct MotionCalibration
2325
{
2426
short xoff, yoff, zoff, goff;
@@ -145,6 +147,7 @@ int motion_rotation(void);
145147
///
146148
/// @return
147149
/// The calibration settings.
150+
WARN_UNUSED_RESULT
148151
MotionCalibration *motion_get_calibration(void);
149152

150153
/// This sets the calibration settings.

include/nds/arm9/peripherals/slot2.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ extern "C" {
1616
#include <stdbool.h>
1717
#include <stdint.h>
1818

19+
#include <nds/ndstypes.h>
20+
1921
// TODO: Peripherals marked as "TODO" are not currently detected.
2022
// In addition, the following are not listed due to insufficient information:
2123
// - Activity Meters
@@ -72,6 +74,7 @@ bool peripheralSlot2IsDetected(void);
7274
///
7375
/// @return
7476
/// Pointer to the string. Don't call free() with this pointer.
77+
WARN_UNUSED_RESULT
7578
const char *peripheralSlot2GetName(void);
7679

7780
/// Get the mask of SLOT2_PERIPHERALs supported by this device.
@@ -99,6 +102,7 @@ void peripheralSlot2Close(void);
99102
///
100103
/// @return
101104
/// A pointer to the start of the RAM space, or NULL.
105+
WARN_UNUSED_RESULT
102106
uint16_t *peripheralSlot2RamStart(void);
103107

104108
/// Return the size, in bytes, of Slot-2 RAM space; 0 if not detected.

include/nds/arm9/videoGL.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ void glRotatef32i(int angle, int32_t x, int32_t y, int32_t z);
446446
///
447447
/// @return
448448
/// 1 on success, 0 on failure.
449+
WARN_UNUSED_RESULT
449450
int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX,
450451
int sizeY, int empty2, int param, const void *texture);
451452

@@ -508,6 +509,7 @@ static inline enum GL_TEXTURE_SIZE_ENUM glTexSizeToEnum(int size)
508509
///
509510
/// @return
510511
/// 1 on success, 0 on failure.
512+
WARN_UNUSED_RESULT
511513
int glColorTableEXT(int target, int empty1, uint16_t width, int empty2,
512514
int empty3, const void *table);
513515

@@ -529,6 +531,7 @@ int glColorTableEXT(int target, int empty1, uint16_t width, int empty2,
529531
///
530532
/// @return
531533
/// 1 on success, 0 on failure.
534+
WARN_UNUSED_RESULT
532535
int glColorSubTableEXT(int target, int start, int count, int empty1,
533536
int empty2, const void *data);
534537

@@ -546,6 +549,7 @@ int glColorSubTableEXT(int target, int start, int count, int empty1,
546549
///
547550
/// @return
548551
/// 1 on success, 0 on failure.
552+
WARN_UNUSED_RESULT
549553
int glGetColorTableEXT(int target, int empty1, int empty2, void *table);
550554

551555
/// glAssignColorTable sets the active texture with a palette set with another
@@ -562,6 +566,7 @@ int glGetColorTableEXT(int target, int empty1, int empty2, void *table);
562566
///
563567
/// @return
564568
/// 1 on success, 0 on failure.
569+
WARN_UNUSED_RESULT
565570
int glAssignColorTable(int target, int name);
566571

567572
/// Set parameters for the current texture.
@@ -597,6 +602,7 @@ u32 glGetTexParameter(void);
597602
///
598603
/// @return
599604
/// 1 on success, 0 on failure.
605+
WARN_UNUSED_RESULT
600606
int glGetColorTableParameterEXT(int target, int pname, int *params);
601607

602608
/// Returns the address allocated to the texure named by name.
@@ -649,6 +655,7 @@ int glBindTexture(int target, int name);
649655
///
650656
/// @return
651657
/// 1 on success, 0 on failure.
658+
WARN_UNUSED_RESULT
652659
int glGenTextures(int n, int *names);
653660

654661
/// Deletes the specified number of textures (and associated palettes).
@@ -1457,6 +1464,7 @@ static inline void glCutoffDepth(fixed12d3 wVal)
14571464
///
14581465
/// @return
14591466
/// 1 on success, 0 on failure
1467+
WARN_UNUSED_RESULT
14601468
int glInit(void);
14611469

14621470
/// Sets the color of the rear-plane (a.k.a clear color/plane)

include/nds/disc_io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ typedef struct DISC_INTERFACE_STRUCT
102102
} DISC_INTERFACE;
103103

104104
/// Return the internal DSi SD card interface.
105+
WARN_UNUSED_RESULT
105106
const DISC_INTERFACE *get_io_dsisd(void);
106107

107108
#ifdef __cplusplus

include/nds/system.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,22 @@ bool setCpuClock(bool speed);
267267
///
268268
/// @return
269269
/// Returns a pointer to the start of the heap.
270+
WARN_UNUSED_RESULT
270271
u8 *getHeapStart(void);
271272

272273
/// Returns current end of heap space.
273274
///
274275
/// @return
275276
/// Returns a pointer to the end of the heap.
277+
WARN_UNUSED_RESULT
276278
u8 *getHeapEnd(void);
277279

278280
/// Returns current heap limit.
279281
///
280282
/// @return
281283
/// Returns a pointer to the limit of the heap. It won't grow past this
282284
/// address.
285+
WARN_UNUSED_RESULT
283286
u8 *getHeapLimit(void);
284287

285288
#endif // ARM9

source/common/libnds_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef struct __TransferRegion
2121
struct __bootstub *bootcode;
2222
} __TransferRegion, *__pTransferRegion;
2323

24+
WARN_UNUSED_RESULT
2425
static inline __TransferRegion volatile *__transferRegion(void)
2526
{
2627
// The transfer region address needs to be in an uncached mirror of main RAM

0 commit comments

Comments
 (0)