Skip to content

Commit

Permalink
config: Don't mix [[attr]] and __attribute__((attr))
Browse files Browse the repository at this point in the history
GCC and Clang don't support combining the two attribute syntaxes in
arbitrary order.  For now, just use the GNU style.
  • Loading branch information
tavianator committed Mar 19, 2024
1 parent 2c3ef3a commit 10b2c56
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ typedef long double max_align_t;
/**
* Silence warnings about unused declarations.
*/
#if __has_c_attribute(maybe_unused)
# define attr_maybe_unused [[maybe_unused]]
#elif __has_attribute(unused)
#if __has_attribute(unused)
# define attr_maybe_unused __attribute__((unused))
#else
# define attr_maybe_unused
Expand All @@ -214,9 +212,7 @@ typedef long double max_align_t;
/**
* Warn if a value is unused.
*/
#if __has_c_attribute(nodiscard)
# define attr_nodiscard [[nodiscard]]
#elif __has_attribute(warn_unused_result)
#if __has_attribute(warn_unused_result)
# define attr_nodiscard __attribute__((warn_unused_result))
#else
# define attr_nodiscard
Expand Down

0 comments on commit 10b2c56

Please sign in to comment.