Skip to content

Commit df7e2a9

Browse files
authored
Merge pull request #1800 from hwti/glib-conflict
Do not define __has_attribute in a public header
2 parents 63a711b + 6552e0a commit df7e2a9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

include/CppUTest/CppUTestConfig.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@
100100
* This is needed for compiling with clang, without breaking other compilers.
101101
*/
102102
#ifndef __has_attribute
103-
#define __has_attribute(x) 0
103+
#define CPPUTEST_HAS_ATTRIBUTE(x) 0
104+
#else
105+
#define CPPUTEST_HAS_ATTRIBUTE(x) __has_attribute(x)
104106
#endif
105107

106108
#if defined (__cplusplus) && __cplusplus >= 201103L
107109
#define CPPUTEST_NORETURN [[noreturn]]
108-
#elif __has_attribute(noreturn)
110+
#elif CPPUTEST_HAS_ATTRIBUTE(noreturn)
109111
#define CPPUTEST_NORETURN __attribute__((noreturn))
110112
#else
111113
#define CPPUTEST_NORETURN
@@ -117,7 +119,7 @@
117119
#define CPPUTEST_CHECK_FORMAT_TYPE printf
118120
#endif
119121

120-
#if __has_attribute(format)
122+
#if CPPUTEST_HAS_ATTRIBUTE(format)
121123
#define CPPUTEST_CHECK_FORMAT(type, format_parameter, other_parameters) __attribute__ ((format (type, format_parameter, other_parameters)))
122124
#else
123125
#define CPPUTEST_CHECK_FORMAT(type, format_parameter, other_parameters) /* type, format_parameter, other_parameters */

0 commit comments

Comments
 (0)