[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test for visibility
From: |
Russ Allbery |
Subject: |
Re: test for visibility |
Date: |
Wed, 25 Apr 2012 17:32:51 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
"Andrew W. Nosenko" <address@hidden> writes:
> Ok, but what if compiler does not support "#pragma GCC visibility",
> what you plan to do?
> The reason of question: if samples above are full, i.e. you indeed
> don't have #else part, then you just don't need the #if at all.
> If compiler supports "#pragma GCC visibility" then it will execute it
> with #if (because HAVE_PRAGMA_VISIBILITY will be defined) or without.
> If compiler doesn't support it, then pragma GCC visibility will be
> skipped with #if (because undefined HAVE_PRAGMA_VISIBILITY) or without
> (just because unknown pragmas are ignored per standard).
Indeed, all of my code just uses pairs of:
#pragma GCC visibility push(hidden)
#pragma GCC visibility pop
unconditionally. Non-GCC compilers just ignore the pragmata (and then
hopefully some of the same effect, although not the performance gains, are
imposed by either symbol versioning or by libtool export lists, depending
on what's available).
--
Russ Allbery (address@hidden) <http://www.eyrie.org/~eagle/>