summaryrefslogtreecommitdiffstats
path: root/libcutils/atomic.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2012-12-07 10:54:09 -0800
committerBen Cheng <bccheng@google.com>2012-12-07 11:07:10 -0800
commit5206d5971208fab8208669dabc98bbb9f7e4a45a (patch)
treed1aa198eeadbd1bd4e04e0f6faa37a8576d81781 /libcutils/atomic.c
parent777991d9399f1268d27c72a03d56c1a36068a57f (diff)
downloadsystem_core-5206d5971208fab8208669dabc98bbb9f7e4a45a.zip
system_core-5206d5971208fab8208669dabc98bbb9f7e4a45a.tar.gz
system_core-5206d5971208fab8208669dabc98bbb9f7e4a45a.tar.bz2
Fail-proof the inline directives for SMP atomic operations.
The various atomic operations are declared as inline in the header files to cut the function call overhead. However, the plain inline keyword is just a suggestion to the compiler which makes its own decision on whether to inline them or not. Worst, if they are not inlined, the -fvisibility-inlines-hidden compiler flag will render them as hidden symbols in the object file. If they are picked up by the linker over the ones supplied in libcutils.so the following warning will be reported: warning: hidden symbol 'android_atomic_inc' in foo.o is referenced by DSO bar.so One way is to add __attribute__((visibility("default"))) to those inline functions to suppress the linker warnings. A better way is to force inlining as with this patch. Change-Id: Ie4fcfdfaaf06f42d351619a0d89671a9df15ca2f
Diffstat (limited to 'libcutils/atomic.c')
-rw-r--r--libcutils/atomic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcutils/atomic.c b/libcutils/atomic.c
index f6cd8b0..1484ef8 100644
--- a/libcutils/atomic.c
+++ b/libcutils/atomic.c
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-#define inline
+#define ANDROID_ATOMIC_INLINE
#include <cutils/atomic-inline.h>