summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scanner.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/scanner.c b/src/scanner.c
index 679e006..c93070c 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1744,7 +1744,11 @@ emit_code(struct protocol *protocol, enum visibility vis)
* we want to have the symbols hidden. */
if (vis == PRIVATE) {
symbol_visibility = "WL_PRIVATE";
- printf("#if defined(__GNUC__) && __GNUC__ >= 4\n"
+ printf("#ifndef __has_attribute\n"
+ "# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */\n"
+ "#endif\n\n");
+
+ printf("#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4\n"
"#define WL_PRIVATE __attribute__ ((visibility(\"hidden\")))\n"
"#else\n"
"#define WL_PRIVATE\n"