add function attributes __malloc__ and __alloc_size__ for gcc and clang

This commit is contained in:
2026-01-07 09:59:31 -06:00
committed by Andrew Johnson
parent b2ed8bb98d
commit 80c708fdeb
4 changed files with 21 additions and 2 deletions
+3 -2
View File
@@ -67,7 +67,7 @@ void cantProceed(
* Will never return NULL otherwise.
*/
LIBCOM_API void * callocMustSucceed(size_t count, size_t size,
const char *errorMessage);
const char *errorMessage) EPICS_MALLOC(1,2);
/** \brief A malloc() which suspends on error.
* \param size Size of block to allocate.
* \param errorMessage Context added to logged error message
@@ -76,7 +76,8 @@ LIBCOM_API void * callocMustSucceed(size_t count, size_t size,
* Will always return NULL for a zero length allocation.
* Will never return NULL otherwise.
*/
LIBCOM_API void * mallocMustSucceed(size_t size, const char *errorMessage);
LIBCOM_API void * mallocMustSucceed(size_t size, const char *errorMessage)
EPICS_MALLOC(1);
/** @} */
#ifdef __cplusplus