blob: f465ba1da9e3bfd31ef09ddfb167d72be54981c4 [file] [log] [blame]
Taylor Holbertonbc86b6b2019-01-13 13:10:47 -05001#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 Lic0d68b12020-12-02 07:46:19 +00009// 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 Holbertonbc86b6b2019-01-13 13:10:47 -050015
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 Lic0d68b12020-12-02 07:46:19 +000028#else /* __GNUC__ && !ANDROID */
Taylor Holbertonbc86b6b2019-01-13 13:10:47 -050029
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 Lic0d68b12020-12-02 07:46:19 +000042#endif /* __GNUC__ && !ANDROID */
Taylor Holbertonbc86b6b2019-01-13 13:10:47 -050043
44#endif /* TINYALSA_ATTRIBUTES_H */