summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorElliott Hughes2018-07-02 12:52:49 -0500
committerElliott Hughes2018-07-02 12:53:22 -0500
commit98c76496be76edcdcbc34ac6543c0f078510a26f (patch)
treeaa9e06042e41d175812fe0ce652548623b704126 /base
parent8b80960417edc4ede3f78349b60fc6bdd831efd2 (diff)
downloadplatform-system-core-98c76496be76edcdcbc34ac6543c0f078510a26f.tar.gz
platform-system-core-98c76496be76edcdcbc34ac6543c0f078510a26f.tar.xz
platform-system-core-98c76496be76edcdcbc34ac6543c0f078510a26f.zip
libbase: assume clang.
Bug: N/A Test: builds Change-Id: Ic3d3bee26496025324a3d070e3fcbf6d7b917709
Diffstat (limited to 'base')
-rw-r--r--base/include/android-base/logging.h7
-rw-r--r--base/include/android-base/macros.h10
-rw-r--r--base/include/android-base/parseint.h2
-rw-r--r--base/include/android-base/thread_annotations.h6
-rw-r--r--base/include/android-base/unique_fd.h8
5 files changed, 2 insertions, 31 deletions
diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h
index 7f0801f6c..aea6ce601 100644
--- a/base/include/android-base/logging.h
+++ b/base/include/android-base/logging.h
@@ -487,21 +487,14 @@ namespace std {
487// Note: to print the pointer, use "<< static_cast<const void*>(string_pointer)" instead. 487// Note: to print the pointer, use "<< static_cast<const void*>(string_pointer)" instead.
488// Note: a not-recommended alternative is to let Clang ignore the warning by adding 488// Note: a not-recommended alternative is to let Clang ignore the warning by adding
489// -Wno-user-defined-warnings to CPPFLAGS. 489// -Wno-user-defined-warnings to CPPFLAGS.
490#ifdef __clang__
491#pragma clang diagnostic push 490#pragma clang diagnostic push
492#pragma clang diagnostic ignored "-Wgcc-compat" 491#pragma clang diagnostic ignored "-Wgcc-compat"
493#define OSTREAM_STRING_POINTER_USAGE_WARNING \ 492#define OSTREAM_STRING_POINTER_USAGE_WARNING \
494 __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) 493 __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning")))
495#else
496#define OSTREAM_STRING_POINTER_USAGE_WARNING /* empty */
497#endif
498inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) 494inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer)
499 OSTREAM_STRING_POINTER_USAGE_WARNING { 495 OSTREAM_STRING_POINTER_USAGE_WARNING {
500 return stream << static_cast<const void*>(string_pointer); 496 return stream << static_cast<const void*>(string_pointer);
501} 497}
502#ifdef __clang__
503#pragma clang diagnostic pop 498#pragma clang diagnostic pop
504#endif
505#undef OSTREAM_STRING_POINTER_USAGE_WARNING
506 499
507} // namespace std 500} // namespace std
diff --git a/base/include/android-base/macros.h b/base/include/android-base/macros.h
index 0c8eac03c..49cc0c980 100644
--- a/base/include/android-base/macros.h
+++ b/base/include/android-base/macros.h
@@ -170,17 +170,7 @@ void UNUSED(const T&...) {
170// 170//
171// In either case this macro has no effect on runtime behavior and performance 171// In either case this macro has no effect on runtime behavior and performance
172// of code. 172// of code.
173#if defined(__clang__) && defined(__has_warning)
174#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
175#define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT 173#define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT
176#endif
177#endif
178
179#ifndef FALLTHROUGH_INTENDED
180#define FALLTHROUGH_INTENDED \
181 do { \
182 } while (0)
183#endif
184 174
185// Current ABI string 175// Current ABI string
186#if defined(__arm__) 176#if defined(__arm__)
diff --git a/base/include/android-base/parseint.h b/base/include/android-base/parseint.h
index 933d877fb..fc68d56b4 100644
--- a/base/include/android-base/parseint.h
+++ b/base/include/android-base/parseint.h
@@ -42,9 +42,7 @@ bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(),
42 const char* suffixes = "bkmgtpe"; 42 const char* suffixes = "bkmgtpe";
43 const char* suffix; 43 const char* suffix;
44 if (!allow_suffixes || (suffix = strchr(suffixes, tolower(*end))) == nullptr) return false; 44 if (!allow_suffixes || (suffix = strchr(suffixes, tolower(*end))) == nullptr) return false;
45#if __clang__ // TODO: win32 still builds with GCC :-(
46 if (__builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), &result)) return false; 45 if (__builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), &result)) return false;
47#endif
48 } 46 }
49 if (max < result) { 47 if (max < result) {
50 return false; 48 return false;
diff --git a/base/include/android-base/thread_annotations.h b/base/include/android-base/thread_annotations.h
index d56e9355d..5c55e6300 100644
--- a/base/include/android-base/thread_annotations.h
+++ b/base/include/android-base/thread_annotations.h
@@ -16,11 +16,7 @@
16 16
17#pragma once 17#pragma once
18 18
19#if defined(__SUPPORT_TS_ANNOTATION__) || defined(__clang__) 19#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
20#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
21#else
22#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
23#endif
24 20
25#define CAPABILITY(x) \ 21#define CAPABILITY(x) \
26 THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) 22 THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h
index d334e30ed..6cfcd3fb0 100644
--- a/base/include/android-base/unique_fd.h
+++ b/base/include/android-base/unique_fd.h
@@ -142,10 +142,4 @@ inline bool Socketpair(int type, unique_fd* left, unique_fd* right) {
142 142
143template <typename T> 143template <typename T>
144int close(const android::base::unique_fd_impl<T>&) 144int close(const android::base::unique_fd_impl<T>&)
145#if defined(__clang__) 145 __attribute__((__unavailable__("close called on unique_fd")));
146 __attribute__((__unavailable__(
147#else
148 __attribute__((__error__(
149#endif
150 "close called on unique_fd"
151 )));