diff --git a/include/nds/arm9/dynamicArray.h b/include/nds/arm9/dynamicArray.h index 01f9ffce..6439e1d0 100644 --- a/include/nds/arm9/dynamicArray.h +++ b/include/nds/arm9/dynamicArray.h @@ -35,6 +35,7 @@ typedef struct DynamicArray /// /// @return /// A pointer to the data, or NULL on error. +WARN_UNUSED_RESULT void *DynamicArrayInit(DynamicArray *v, unsigned int initialSize); /// Frees memory allocated by the dynamic array. @@ -52,6 +53,7 @@ void DynamicArrayDelete(DynamicArray *v); /// /// @return /// The data or NULL if v is NULL or the index is out of range. +WARN_UNUSED_RESULT void *DynamicArrayGet(DynamicArray *v, unsigned int index); /// Sets the entry to the supplied value. @@ -65,6 +67,7 @@ void *DynamicArrayGet(DynamicArray *v, unsigned int index); /// /// @return /// Returns false if v is NULL or there isn't enough memory, true otherwise. +WARN_UNUSED_RESULT bool DynamicArraySet(DynamicArray *v, unsigned int index, void *item); #ifdef __cplusplus diff --git a/include/nds/arm9/linkedlist.h b/include/nds/arm9/linkedlist.h index a27879d7..0d15f671 100644 --- a/include/nds/arm9/linkedlist.h +++ b/include/nds/arm9/linkedlist.h @@ -16,6 +16,8 @@ extern "C" { #endif +#include + /// A node of the linked list. typedef struct LinkedList { @@ -38,6 +40,7 @@ typedef struct LinkedList /// @return /// A pointer to the new node, which is also the new front, or NULL if there /// is not enough memory. +WARN_UNUSED_RESULT LinkedList *linkedlistAdd(LinkedList **front, void *data); /// Removes a node from a linked list. diff --git a/include/nds/arm9/sprite.h b/include/nds/arm9/sprite.h index b50784bd..b515c7c0 100644 --- a/include/nds/arm9/sprite.h +++ b/include/nds/arm9/sprite.h @@ -386,6 +386,7 @@ u16 *oamGetGfxPtr(OamState *oam, int gfxOffsetIndex); /// /// @return /// The address in VRAM of the allocated sprite. +WARN_UNUSED_RESULT u16 *oamAllocateGfx(OamState *oam, SpriteSize size, SpriteColorFormat colorFormat); /// Free VRAM memory obtained with oamAllocateGfx. diff --git a/include/nds/arm9/videoGL.h b/include/nds/arm9/videoGL.h index 0cb5011e..eaf90b78 100644 --- a/include/nds/arm9/videoGL.h +++ b/include/nds/arm9/videoGL.h @@ -446,6 +446,7 @@ void glRotatef32i(int angle, int32_t x, int32_t y, int32_t z); /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const void *texture); @@ -508,6 +509,7 @@ static inline enum GL_TEXTURE_SIZE_ENUM glTexSizeToEnum(int size) /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glColorTableEXT(int target, int empty1, uint16_t width, int empty2, int empty3, const void *table); @@ -529,6 +531,7 @@ int glColorTableEXT(int target, int empty1, uint16_t width, int empty2, /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glColorSubTableEXT(int target, int start, int count, int empty1, int empty2, const void *data); @@ -546,6 +549,7 @@ int glColorSubTableEXT(int target, int start, int count, int empty1, /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glGetColorTableEXT(int target, int empty1, int empty2, void *table); /// 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); /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glAssignColorTable(int target, int name); /// Set parameters for the current texture. @@ -597,6 +602,7 @@ u32 glGetTexParameter(void); /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glGetColorTableParameterEXT(int target, int pname, int *params); /// Returns the address allocated to the texure named by name. @@ -649,6 +655,7 @@ int glBindTexture(int target, int name); /// /// @return /// 1 on success, 0 on failure. +WARN_UNUSED_RESULT int glGenTextures(int n, int *names); /// Deletes the specified number of textures (and associated palettes). @@ -1457,6 +1464,7 @@ static inline void glCutoffDepth(fixed12d3 wVal) /// /// @return /// 1 on success, 0 on failure +WARN_UNUSED_RESULT int glInit(void); /// Sets the color of the rear-plane (a.k.a clear color/plane) diff --git a/include/nds/ndstypes.h b/include/nds/ndstypes.h index 3a1cd08e..dcbefb6d 100644 --- a/include/nds/ndstypes.h +++ b/include/nds/ndstypes.h @@ -66,6 +66,10 @@ extern "C" { /// for the compiler. #define COMPILER_MEMORY_BARRIER() asm volatile("" ::: "memory") +/// Makes the compiler output a warning if the return value of a function is +/// ignored. +#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) + // Macros related to the bin2o macro of the Makefile #define GETRAW(name) (name) #define GETRAWSIZE(name) ((int)name##_size)