mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
scanner: make use of __has_attribute()
A more generic way to evaluating various attributes, __has_attribute is available with gcc, clang, even the Oracle/Sun compiler. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
parent
ab6b156920
commit
bd92689382
1 changed files with 5 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue