Skip to content

Commit

Permalink
utils: Wrap attributes in underscores
Browse files Browse the repository at this point in the history
  • Loading branch information
LekKit committed Aug 31, 2024
1 parent eefc90c commit 7ca0085
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#define LOG_WARN 2
#define LOG_INFO 3

#if GNU_ATTRIBUTE(format)
#define PRINT_FORMAT __attribute__((format(printf, 1, 2)))
#if GNU_ATTRIBUTE(__format__)
#define PRINT_FORMAT __attribute__((__format__(printf, 1, 2)))
#else
#define PRINT_FORMAT
#endif

#if GNU_ATTRIBUTE(returns_nonnull) && GNU_ATTRIBUTE(warn_unused_result) && GNU_ATTRIBUTE(alloc_size)
#define SAFE_MALLOC __attribute__((returns_nonnull, warn_unused_result, malloc, alloc_size(1)))
#define SAFE_CALLOC __attribute__((returns_nonnull, warn_unused_result, malloc, alloc_size(1, 2)))
#define SAFE_REALLOC __attribute__((returns_nonnull, warn_unused_result, alloc_size(2)))
#if GNU_ATTRIBUTE(__returns_nonnull__) && GNU_ATTRIBUTE(__warn_unused_result__) && GNU_ATTRIBUTE(__alloc_size__)
#define SAFE_MALLOC __attribute__((__returns_nonnull__, __warn_unused_result__, __malloc__, __alloc_size__(1)))
#define SAFE_CALLOC __attribute__((__returns_nonnull__, __warn_unused_result__, __malloc__, __alloc_size__(1, 2)))
#define SAFE_REALLOC __attribute__((__returns_nonnull__, __warn_unused_result__, __alloc_size__(2)))
#else
#define SAFE_MALLOC
#define SAFE_CALLOC
Expand Down

0 comments on commit 7ca0085

Please sign in to comment.