You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2020/03/30 18:56:36 UTC
[kudu] 02/07: gutil: remove BASE_EXPORT
This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 5db82975fd9729d90551b7a4c8f4b28b5375deef
Author: Adar Dembo <ad...@cloudera.com>
AuthorDate: Sat Mar 28 01:22:31 2020 -0700
gutil: remove BASE_EXPORT
The various definitions of BASE_EXPORT cause IWYU to recommend the inclusion
of thread_collision_warner.h as a means of satisfying them. Since it serves
no purpose in Kudu, let's remove the macro altogether.
Change-Id: I8e1650f3a18b17898ab8082923fc2fb9c8471946
Reviewed-on: http://gerrit.cloudera.org:8080/15576
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
src/kudu/gutil/atomicops-internals-tsan.h | 11 +++--------
src/kudu/gutil/bind_helpers.h | 4 ----
src/kudu/gutil/ref_counted_memory.h | 18 +++++++-----------
src/kudu/gutil/threading/thread_collision_warner.h | 16 ++++++----------
src/kudu/util/debug/trace_event.h | 12 ++++--------
src/kudu/util/debug/trace_event_impl.cc | 3 ++-
src/kudu/util/debug/trace_event_impl.h | 13 ++++++-------
src/kudu/util/debug/trace_event_synthetic_delay.h | 10 +++++-----
8 files changed, 33 insertions(+), 54 deletions(-)
diff --git a/src/kudu/gutil/atomicops-internals-tsan.h b/src/kudu/gutil/atomicops-internals-tsan.h
index dea45b0..1dd1c75 100644
--- a/src/kudu/gutil/atomicops-internals-tsan.h
+++ b/src/kudu/gutil/atomicops-internals-tsan.h
@@ -9,20 +9,15 @@
#ifndef BASE_ATOMICOPS_INTERNALS_TSAN_H_
#define BASE_ATOMICOPS_INTERNALS_TSAN_H_
-// Workaround for Chromium BASE_EXPORT definition
-#ifndef BASE_EXPORT
-#define BASE_EXPORT
-#endif
-
// This struct is not part of the public API of this module; clients may not
-// use it. (However, it's exported via BASE_EXPORT because clients implicitly
-// do use it at link time by inlining these functions.)
+// use it.
+//
// Features of this x86. Values may not be correct before main() is run,
// but are set conservatively.
struct AtomicOps_x86CPUFeatureStruct {
bool has_sse2; // Processor has SSE2.
};
-BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct
+extern struct AtomicOps_x86CPUFeatureStruct
AtomicOps_Internalx86CPUFeatures;
#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
diff --git a/src/kudu/gutil/bind_helpers.h b/src/kudu/gutil/bind_helpers.h
index 8a106a6..f8dabe6 100644
--- a/src/kudu/gutil/bind_helpers.h
+++ b/src/kudu/gutil/bind_helpers.h
@@ -149,10 +149,6 @@
#include "kudu/gutil/callback.h"
#include "kudu/gutil/template_util.h"
-// Unneeded define from Chromium
-#define BASE_EXPORT
-
-
namespace kudu {
namespace internal {
diff --git a/src/kudu/gutil/ref_counted_memory.h b/src/kudu/gutil/ref_counted_memory.h
index d180db9..23ced27 100644
--- a/src/kudu/gutil/ref_counted_memory.h
+++ b/src/kudu/gutil/ref_counted_memory.h
@@ -15,16 +15,12 @@
#include "kudu/gutil/port.h"
#include "kudu/gutil/threading/thread_collision_warner.h"
-#ifndef BASE_EXPORT
-#define BASE_EXPORT
-#endif
-
namespace kudu {
// A generic interface to memory. This object is reference counted because one
// of its two subclasses own the data they carry, and we need to have
// heterogeneous containers of these two types of memory.
-class BASE_EXPORT RefCountedMemory
+class RefCountedMemory
: public RefCountedThreadSafe<RefCountedMemory> {
public:
// Retrieves a pointer to the beginning of the data we point to. If the data
@@ -50,12 +46,12 @@ class BASE_EXPORT RefCountedMemory
// An implementation of RefCountedMemory, where the ref counting does not
// matter.
-class BASE_EXPORT RefCountedStaticMemory : public RefCountedMemory {
+class RefCountedStaticMemory : public RefCountedMemory {
public:
RefCountedStaticMemory()
- : data_(NULL), length_(0) {}
+ : data_(nullptr), length_(0) {}
RefCountedStaticMemory(const void* data, size_t length)
- : data_(static_cast<const unsigned char*>(length ? data : NULL)),
+ : data_(static_cast<const unsigned char*>(length ? data : nullptr)),
length_(length) {}
// Overridden from RefCountedMemory:
@@ -72,7 +68,7 @@ class BASE_EXPORT RefCountedStaticMemory : public RefCountedMemory {
};
// An implementation of RefCountedMemory, where we own the data in a vector.
-class BASE_EXPORT RefCountedBytes : public RefCountedMemory {
+class RefCountedBytes : public RefCountedMemory {
public:
RefCountedBytes();
@@ -104,7 +100,7 @@ class BASE_EXPORT RefCountedBytes : public RefCountedMemory {
// An implementation of RefCountedMemory, where the bytes are stored in an STL
// string. Use this if your data naturally arrives in that format.
-class BASE_EXPORT RefCountedString : public RefCountedMemory {
+class RefCountedString : public RefCountedMemory {
public:
RefCountedString();
@@ -131,7 +127,7 @@ class BASE_EXPORT RefCountedString : public RefCountedMemory {
// An implementation of RefCountedMemory that holds a chunk of memory
// previously allocated with malloc or calloc, and that therefore must be freed
// using free().
-class BASE_EXPORT RefCountedMallocedMemory : public RefCountedMemory {
+class RefCountedMallocedMemory : public RefCountedMemory {
public:
RefCountedMallocedMemory(void* data, size_t length);
diff --git a/src/kudu/gutil/threading/thread_collision_warner.h b/src/kudu/gutil/threading/thread_collision_warner.h
index 9cad17f..d042b33 100644
--- a/src/kudu/gutil/threading/thread_collision_warner.h
+++ b/src/kudu/gutil/threading/thread_collision_warner.h
@@ -10,10 +10,6 @@
#include "kudu/gutil/atomicops.h"
#include "kudu/gutil/macros.h"
-#ifndef BASE_EXPORT
-#define BASE_EXPORT
-#endif
-
// A helper class alongside macros to be used to verify assumptions about thread
// safety of a class.
//
@@ -134,17 +130,17 @@ namespace base {
// AsserterBase is the interfaces and DCheckAsserter is the default asserter
// used. During the unit tests is used another class that doesn't "DCHECK"
// in case of collision (check thread_collision_warner_unittests.cc)
-struct BASE_EXPORT AsserterBase {
+struct AsserterBase {
virtual ~AsserterBase() {}
virtual void warn(int64_t previous_thread_id, int64_t current_thread_id) = 0;
};
-struct BASE_EXPORT DCheckAsserter : public AsserterBase {
+struct DCheckAsserter : public AsserterBase {
virtual ~DCheckAsserter() {}
void warn(int64_t previous_thread_id, int64_t current_thread_id) override;
};
-class BASE_EXPORT ThreadCollisionWarner {
+class ThreadCollisionWarner {
public:
// The parameter asserter is there only for test purpose
explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
@@ -161,7 +157,7 @@ class BASE_EXPORT ThreadCollisionWarner {
// it doesn't leave the critical section, as opposed to ScopedCheck,
// because the critical section being pinned is allowed to be used only
// from one thread
- class BASE_EXPORT Check {
+ class Check {
public:
explicit Check(ThreadCollisionWarner* warner)
: warner_(warner) {
@@ -178,7 +174,7 @@ class BASE_EXPORT ThreadCollisionWarner {
// This class is meant to be used through the macro
// DFAKE_SCOPED_LOCK
- class BASE_EXPORT ScopedCheck {
+ class ScopedCheck {
public:
explicit ScopedCheck(ThreadCollisionWarner* warner)
: warner_(warner) {
@@ -197,7 +193,7 @@ class BASE_EXPORT ThreadCollisionWarner {
// This class is meant to be used through the macro
// DFAKE_SCOPED_RECURSIVE_LOCK
- class BASE_EXPORT ScopedRecursiveCheck {
+ class ScopedRecursiveCheck {
public:
explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner)
: warner_(warner) {
diff --git a/src/kudu/util/debug/trace_event.h b/src/kudu/util/debug/trace_event.h
index 2c51309..7bfc1a9 100644
--- a/src/kudu/util/debug/trace_event.h
+++ b/src/kudu/util/debug/trace_event.h
@@ -823,12 +823,8 @@
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) \
base::subtle::NoBarrier_Store(&(var), (value))
-// Defines visibility for classes in trace_event.h
-#define TRACE_EVENT_API_CLASS_EXPORT BASE_EXPORT
-
// The thread buckets for the sampling profiler.
-TRACE_EVENT_API_CLASS_EXPORT extern \
- TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
+extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
#define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \
g_trace_state[thread_bucket]
@@ -1377,10 +1373,10 @@ static inline kudu::debug::TraceEventHandle AddTraceEvent(
}
// Used by TRACE_EVENTx macros. Do not use directly.
-class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
+class ScopedTracer {
public:
// Note: members of data_ intentionally left uninitialized. See Initialize.
- ScopedTracer() : p_data_(NULL) {}
+ ScopedTracer() : p_data_(nullptr) {}
~ScopedTracer() {
if (p_data_ && *data_.category_group_enabled)
@@ -1413,7 +1409,7 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
};
// Used by TRACE_EVENT_BINARY_EFFICIENTx macro. Do not use directly.
-class TRACE_EVENT_API_CLASS_EXPORT ScopedTraceBinaryEfficient {
+class ScopedTraceBinaryEfficient {
public:
ScopedTraceBinaryEfficient(const char* category_group, const char* name);
~ScopedTraceBinaryEfficient();
diff --git a/src/kudu/util/debug/trace_event_impl.cc b/src/kudu/util/debug/trace_event_impl.cc
index f642657..6388243 100644
--- a/src/kudu/util/debug/trace_event_impl.cc
+++ b/src/kudu/util/debug/trace_event_impl.cc
@@ -22,6 +22,7 @@
#include <gflags/gflags.h>
#include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
#include "kudu/gutil/dynamic_annotations.h"
#include "kudu/gutil/map-util.h"
#include "kudu/gutil/mathlimits.h"
@@ -52,7 +53,7 @@ DEFINE_string(trace_to_console, "",
TAG_FLAG(trace_to_console, experimental);
// The thread buckets for the sampling profiler.
-BASE_EXPORT TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
+TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
using base::SpinLockHolder;
using strings::SubstituteAndAppend;
diff --git a/src/kudu/util/debug/trace_event_impl.h b/src/kudu/util/debug/trace_event_impl.h
index f0eb4c2..4503e0e 100644
--- a/src/kudu/util/debug/trace_event_impl.h
+++ b/src/kudu/util/debug/trace_event_impl.h
@@ -16,7 +16,6 @@
#include <gtest/gtest_prod.h>
#include "kudu/gutil/atomicops.h"
-#include "kudu/gutil/bind_helpers.h"
#include "kudu/gutil/callback.h"
#include "kudu/gutil/macros.h"
#include "kudu/gutil/ref_counted.h"
@@ -87,7 +86,7 @@ struct TraceEventHandle {
const int kTraceMaxNumArgs = 2;
-class BASE_EXPORT TraceEvent {
+class TraceEvent {
public:
union TraceValue {
bool as_bool;
@@ -180,7 +179,7 @@ class BASE_EXPORT TraceEvent {
};
// TraceBufferChunk is the basic unit of TraceBuffer.
-class BASE_EXPORT TraceBufferChunk {
+class TraceBufferChunk {
public:
explicit TraceBufferChunk(uint32_t seq)
: next_free_(0),
@@ -215,7 +214,7 @@ class BASE_EXPORT TraceBufferChunk {
};
// TraceBuffer holds the events as they are collected.
-class BASE_EXPORT TraceBuffer {
+class TraceBuffer {
public:
virtual ~TraceBuffer() {}
@@ -255,7 +254,7 @@ class TraceResultBuffer {
std::string json_;
};
-class BASE_EXPORT CategoryFilter {
+class CategoryFilter {
public:
typedef std::vector<std::string> StringList;
@@ -342,7 +341,7 @@ class BASE_EXPORT CategoryFilter {
class TraceSamplingThread;
-class BASE_EXPORT TraceLog {
+class TraceLog {
public:
enum Mode {
DISABLED = 0,
@@ -589,9 +588,9 @@ class BASE_EXPORT TraceLog {
// category filter.
void UpdateSyntheticDelaysFromCategoryFilter();
- struct PerThreadInfo;
class OptionalAutoLock;
class ThreadLocalEventBuffer;
+ struct PerThreadInfo;
TraceLog();
~TraceLog();
diff --git a/src/kudu/util/debug/trace_event_synthetic_delay.h b/src/kudu/util/debug/trace_event_synthetic_delay.h
index 5866814..12acec4 100644
--- a/src/kudu/util/debug/trace_event_synthetic_delay.h
+++ b/src/kudu/util/debug/trace_event_synthetic_delay.h
@@ -68,7 +68,7 @@ namespace kudu {
namespace debug {
// Time source for computing delay durations. Used for testing.
-class TRACE_EVENT_API_CLASS_EXPORT TraceEventSyntheticDelayClock {
+class TraceEventSyntheticDelayClock {
public:
TraceEventSyntheticDelayClock();
virtual ~TraceEventSyntheticDelayClock();
@@ -79,7 +79,7 @@ class TRACE_EVENT_API_CLASS_EXPORT TraceEventSyntheticDelayClock {
};
// Single delay point instance.
-class TRACE_EVENT_API_CLASS_EXPORT TraceEventSyntheticDelay {
+class TraceEventSyntheticDelay {
public:
enum Mode {
STATIC, // Apply the configured delay every time.
@@ -136,7 +136,7 @@ class TRACE_EVENT_API_CLASS_EXPORT TraceEventSyntheticDelay {
};
// Set the target durations of all registered synthetic delay points to zero.
-TRACE_EVENT_API_CLASS_EXPORT void ResetTraceEventSyntheticDelays();
+void ResetTraceEventSyntheticDelays();
} // namespace debug
} // namespace kudu
@@ -144,7 +144,7 @@ TRACE_EVENT_API_CLASS_EXPORT void ResetTraceEventSyntheticDelays();
namespace trace_event_internal {
// Helper class for scoped delays. Do not use directly.
-class TRACE_EVENT_API_CLASS_EXPORT ScopedSyntheticDelay {
+class ScopedSyntheticDelay {
public:
explicit ScopedSyntheticDelay(const char* name,
AtomicWord* impl_ptr);
@@ -158,7 +158,7 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedSyntheticDelay {
};
// Helper for registering delays. Do not use directly.
-TRACE_EVENT_API_CLASS_EXPORT kudu::debug::TraceEventSyntheticDelay*
+kudu::debug::TraceEventSyntheticDelay*
GetOrCreateDelay(const char* name, AtomicWord* impl_ptr);
} // namespace trace_event_internal