Cleanup: use nodiscard attribute for functions in the Python API

In most (cases functions returning a PyObject pointer
requires it to be used by the caller, declare functions in the Python
API with the `nodiscard` attribute.
This commit is contained in:
Campbell Barton
2025-06-28 00:15:23 +00:00
parent 0d3826b354
commit 6253a33aa3
71 changed files with 496 additions and 468 deletions

View File

@@ -39,7 +39,7 @@ struct BPyGPUBuffer {
} buf;
};
size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
[[nodiscard]] size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
/**
* Create a buffer object
*
@@ -47,7 +47,7 @@ size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
* \param buffer: When not NULL holds a contiguous buffer
* with the correct format from which the buffer will be initialized
*/
BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format,
const Py_ssize_t *shape,
int shape_len,
void *buffer);
[[nodiscard]] BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format,
const Py_ssize_t *shape,
int shape_len,
void *buffer);