File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
testcases/open_posix_testsuite/include Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 20
20
#define ARRAY_SIZE (arr ) (sizeof(arr) / sizeof(arr[0]))
21
21
#endif
22
22
23
- #define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn))
24
- #define PTS_ATTRIBUTE_UNUSED __attribute__((unused))
25
- #define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
23
+ /* __attribute__ is a non portable gcc extension */
24
+ /* TODO: Add support for C23 attributes */
25
+ #if defined __has_attribute
26
+ # if __has_attribute (noreturn )
27
+ # define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn))
28
+ # endif
29
+ # if __has_attribute (unused )
30
+ # define PTS_ATTRIBUTE_UNUSED __attribute__((unused))
31
+ # endif
32
+ # if __has_attribute (warn_unused_result )
33
+ # define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
34
+ # endif
35
+ #endif
36
+
37
+ #ifndef PTS_ATTRIBUTE_NORETURN
38
+ # define PTS_ATTRIBUTE_NORETURN
39
+ #endif
40
+ #ifndef PTS_ATTRIBUTE_UNUSED
41
+ # define PTS_ATTRIBUTE_UNUSED
42
+ #endif
43
+ #ifndef PTS_ATTRIBUTE_UNUSED_RESULT
44
+ # define PTS_ATTRIBUTE_UNUSED_RESULT
45
+ #endif
26
46
27
47
#define PTS_WRITE_MSG (msg ) do { \
28
48
if (write(STDOUT_FILENO, msg, sizeof(msg) - 1)) { \
You can’t perform that action at this time.
0 commit comments