Taylor Holberton | bc86b6b | 2019-01-13 13:10:47 -0500 | [diff] [blame] | 1 | #ifndef TINYALSA_ATTRIBUTES_H |
| 2 | #define TINYALSA_ATTRIBUTES_H |
| 3 | |
| 4 | /** @defgroup libtinyalsa-attributes |
| 5 | * @brief GCC attributes to issue diagnostics |
| 6 | * when the library is being used incorrectly. |
| 7 | * */ |
| 8 | |
David Li | c0d68b1 | 2020-12-02 07:46:19 +0000 | [diff] [blame] | 9 | // FIXME: Disable the deprecated attribute in Android temporarily. pcm_read/write are marked as |
| 10 | // deprecated functions in the latest tinyalsa in GitHub. However, there are lots of libraries in |
| 11 | // Android using these functions and building with -Werror flags. Besides build breakage, the |
| 12 | // behavior and interface of the successors, pcm_readi/writei, are also changed. Once all have |
| 13 | // been cleaned up, we will enable this again. |
| 14 | #if defined(__GNUC__) && !defined(ANDROID) |
Taylor Holberton | bc86b6b | 2019-01-13 13:10:47 -0500 | [diff] [blame] | 15 | |
| 16 | /** Issues a warning when a function is being |
| 17 | * used that is now deprecated. |
| 18 | * @ingroup libtinyalsa-attributes |
| 19 | * */ |
| 20 | #define TINYALSA_DEPRECATED __attribute__((deprecated)) |
| 21 | |
| 22 | /** Issues a warning when a return code of |
| 23 | * a function is not checked. |
| 24 | * @ingroup libtinyalsa-attributes |
| 25 | * */ |
| 26 | #define TINYALSA_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
| 27 | |
David Li | c0d68b1 | 2020-12-02 07:46:19 +0000 | [diff] [blame] | 28 | #else /* __GNUC__ && !ANDROID */ |
Taylor Holberton | bc86b6b | 2019-01-13 13:10:47 -0500 | [diff] [blame] | 29 | |
| 30 | /** This is just a placeholder for compilers |
| 31 | * that aren't GCC or Clang. |
| 32 | * @ingroup libtinyalsa-attributes |
| 33 | * */ |
| 34 | #define TINYALSA_DEPRECATED |
| 35 | |
| 36 | /** This is just a placeholder for compilers |
| 37 | * that aren't GCC or Clang. |
| 38 | * @ingroup libtinyalsa-attributes |
| 39 | * */ |
| 40 | #define TINYALSA_WARN_UNUSED_RESULT |
| 41 | |
David Li | c0d68b1 | 2020-12-02 07:46:19 +0000 | [diff] [blame] | 42 | #endif /* __GNUC__ && !ANDROID */ |
Taylor Holberton | bc86b6b | 2019-01-13 13:10:47 -0500 | [diff] [blame] | 43 | |
| 44 | #endif /* TINYALSA_ATTRIBUTES_H */ |