Skip to content

Commit

Permalink
feat: add HEDLEY_ALLOC_SIZE macro
Browse files Browse the repository at this point in the history
  • Loading branch information
nemequ committed Sep 20, 2024
1 parent 7f6a9ca commit 82925ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Version 16
==========

* New macros:
* HEDLEY_ALLOC_SIZE
* HEDLEY_DIAGNOSTIC_DISABLE_EXTRA_SEMI
* HEDLEY_DIAGNOSTIC_DISABLE_UNSAFE_BUFFER_USAGE
* Assorted bug fixes and enhancements.
Expand Down
6 changes: 6 additions & 0 deletions hedley.h
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,12 @@ HEDLEY_DIAGNOSTIC_PUSH
#endif
HEDLEY_DIAGNOSTIC_POP

#if HEDLEY_GCC_VERSION_CHECK(4,3,0) || HEDLEY_HAS_ATTRIBUTE(alloc_size)
# define HEDLEY_ALLOC_SIZE(...) __alloc_size__((__VA_ARGS__))
#else
# define HEDLEY_ALLOC_SIZE(...)
#endif

#if defined(HEDLEY_PRINTF_FORMAT)
# undef HEDLEY_PRINTF_FORMAT
#endif
Expand Down
1 change: 1 addition & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ CXX_OUTPUT_FILE ?= --output=
NULL =

TESTS = \
alloc-size \
array-param \
assume \
cast \
Expand Down

0 comments on commit 82925ae

Please sign in to comment.