diff options
author | Mark Salyzyn | 2016-03-10 10:25:33 -0600 |
---|---|---|
committer | Mark Salyzyn | 2016-03-10 16:44:27 -0600 |
commit | 6d753faaf8694792433eb78c5c3572efd74a3d54 (patch) | |
tree | e492ecad9e80855575f7050fab0e250bf8963b7f /liblog/log_cdefs.h | |
parent | 029c7373801b9e1791df334efa36588c216b4ab2 (diff) | |
download | platform-system-core-6d753faaf8694792433eb78c5c3572efd74a3d54.tar.gz platform-system-core-6d753faaf8694792433eb78c5c3572efd74a3d54.tar.xz platform-system-core-6d753faaf8694792433eb78c5c3572efd74a3d54.zip |
liblog: audit declare LIBLOG_ABI_PUBLIC
(cherry pick from commit be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8)
- replace <sys/cdefs.h> with local "log_cdefs.h" which
fortifies and expands definitions, adding LIBLOG_ABI_PUBLIC,
LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE and LIBLOG_WEAK.
- clearly tag each interface as LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN,
LIBLOG_ABI_PRIVATE, LIBLOG_WEAK or static depending on scope
- Add -fvisibility=hidden to ensure nothing else leaks
- some code standard adjustments
Bug: 27566046
Change-Id: Ic14033c4e6d833d973beb035ddc1c6134fb35a3f
Diffstat (limited to 'liblog/log_cdefs.h')
-rw-r--r-- | liblog/log_cdefs.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/liblog/log_cdefs.h b/liblog/log_cdefs.h new file mode 100644 index 000000000..3a526256e --- /dev/null +++ b/liblog/log_cdefs.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _LIBLOG_CDEFS_H__ | ||
18 | #define _LIBLOG_CDEFS_H__ | ||
19 | |||
20 | #include <sys/cdefs.h> | ||
21 | |||
22 | /* Declare this library function hidden and internal */ | ||
23 | #if defined(_WIN32) | ||
24 | #define LIBLOG_HIDDEN | ||
25 | #else | ||
26 | #define LIBLOG_HIDDEN __attribute__((visibility("hidden"))) | ||
27 | #endif | ||
28 | |||
29 | /* Declare this library function visible and external */ | ||
30 | #if defined(_WIN32) | ||
31 | #define LIBLOG_ABI_PUBLIC | ||
32 | #else | ||
33 | #define LIBLOG_ABI_PUBLIC __attribute__((visibility("default"))) | ||
34 | #endif | ||
35 | |||
36 | /* Declare this library function visible but private */ | ||
37 | #define LIBLOG_ABI_PRIVATE LIBLOG_ABI_PUBLIC | ||
38 | |||
39 | /* | ||
40 | * Declare this library function as reimplementation. | ||
41 | * Prevent circular dependencies, but allow _real_ library to hijack | ||
42 | */ | ||
43 | #if defined(_WIN32) | ||
44 | #define LIBLOG_WEAK static /* Accept that it is totally private */ | ||
45 | #else | ||
46 | #define LIBLOG_WEAK __attribute__((weak,visibility("default"))) | ||
47 | #endif | ||
48 | |||
49 | /* Unused argument. For C code only, remove symbol name for C++ */ | ||
50 | #ifndef __unused | ||
51 | #define __unused __attribute__((__unused__)) | ||
52 | #endif | ||
53 | |||
54 | #endif /* _LIBLOG_CDEFS_H__ */ | ||