Remove various bits of lint.
Change-Id: I5f8f61766d2add7fd7ff40d463ea03cb20515988
diff --git a/src/atomic.cc b/src/atomic.cc
index 16d1934..e5c10e4 100644
--- a/src/atomic.cc
+++ b/src/atomic.cc
@@ -43,7 +43,7 @@
#else
int QuasiAtomicCas64(int64_t old_value, int64_t new_value, volatile int64_t* addr) {
- return OSAtomicCompareAndSwap64Barrier(old_value, new_value, (int64_t*)addr) == 0;
+ return OSAtomicCompareAndSwap64Barrier(old_value, new_value, const_cast<int64_t*>(addr)) == 0;
}
static inline int64_t QuasiAtomicSwap64Impl(int64_t value, volatile int64_t* addr) {
diff --git a/src/calling_convention.h b/src/calling_convention.h
index bfd7d21..bdbf1a1 100644
--- a/src/calling_convention.h
+++ b/src/calling_convention.h
@@ -87,7 +87,6 @@
return true; // this argument
}
return shorty_[param] == 'L';
-
}
size_t NumArgs() const {
return num_args_;
diff --git a/src/compiled_class.h b/src/compiled_class.h
index 98f0d9f..7dac93c 100644
--- a/src/compiled_class.h
+++ b/src/compiled_class.h
@@ -9,8 +9,8 @@
class CompiledClass {
public:
- CompiledClass(Class::Status status) : status_(status) {};
- ~CompiledClass() {};
+ explicit CompiledClass(Class::Status status) : status_(status) {}
+ ~CompiledClass() {}
Class::Status GetStatus() const {
return status_;
}
@@ -21,4 +21,3 @@
} // namespace art
#endif // ART_SRC_COMPILED_CLASS_H_
-
diff --git a/src/context.h b/src/context.h
index 75eb8ca..292ac84 100644
--- a/src/context.h
+++ b/src/context.h
@@ -37,7 +37,7 @@
class VmapTable {
public:
- VmapTable(const uint16_t* table) : table_(table) {
+ explicit VmapTable(const uint16_t* table) : table_(table) {
}
uint16_t operator[](size_t i) const {
diff --git a/src/debugger.h b/src/debugger.h
index f8657fe..04066cd 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -70,7 +70,7 @@
};
class Dbg {
-public:
+ public:
static bool ParseJdwpOptions(const std::string& options);
static void SetJdwpAllowed(bool allowed);
diff --git a/src/dex_verifier.h b/src/dex_verifier.h
index 5ef62f5..875b053 100644
--- a/src/dex_verifier.h
+++ b/src/dex_verifier.h
@@ -695,7 +695,7 @@
size_t GetMaxNonZeroReferenceReg(size_t max_ref_reg) {
size_t i = static_cast<int>(max_ref_reg) < 0 ? 0 : max_ref_reg;
- for(; i < num_regs_; i++) {
+ for (; i < num_regs_; i++) {
if (GetRegisterType(i).IsNonZeroReferenceTypes()) {
max_ref_reg = i;
}
@@ -853,13 +853,13 @@
CHECK_EQ(failure_, VERIFY_ERROR_NONE);
failure_ = error;
return fail_messages_ << "VFY: " << PrettyMethod(method_)
- << '[' << (void*)work_insn_idx_ << "] : ";
+ << '[' << reinterpret_cast<void*>(work_insn_idx_) << "] : ";
}
// Log for verification information
std::ostream& LogVerifyInfo() {
return info_messages_ << "VFY: " << PrettyMethod(method_)
- << '[' << (void*)work_insn_idx_ << "] : ";
+ << '[' << reinterpret_cast<void*>(work_insn_idx_) << "] : ";
}
// Dump the state of the verifier, namely each instruction, what flags are set on it, register
diff --git a/src/image_writer.h b/src/image_writer.h
index ad00f71..d32724c 100644
--- a/src/image_writer.h
+++ b/src/image_writer.h
@@ -22,7 +22,7 @@
// Write a Space built during compilation for use during execution.
class ImageWriter {
public:
- ImageWriter(const std::set<std::string>* image_classes)
+ explicit ImageWriter(const std::set<std::string>* image_classes)
: source_space_(NULL), image_top_(0), image_base_(NULL), image_classes_(image_classes) {}
~ImageWriter() {}
diff --git a/src/macros.h b/src/macros.h
index 5b9bdb6..fc65564 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -16,9 +16,7 @@
#include <stddef.h> // for size_t
-#define GCC_VERSION ( _GNUC_ * 10000 \
- + _GNUC_MINOR_ * 100 \
- + __GNUC_PATCHLEVEL__)
+#define GCC_VERSION (_GNUC_ * 10000 + _GNUC_MINOR_ * 100 + __GNUC_PATCHLEVEL__)
// The COMPILE_ASSERT macro can be used to verify that a compile time
// expression is true. For example, you could use it to verify the
@@ -116,7 +114,7 @@
#define ARRAYSIZE_UNSAFE(a) \
((sizeof(a) / sizeof(*(a))) / static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
-#define SIZEOF_MEMBER(t, f) sizeof(((t*) 4096)->f)
+#define SIZEOF_MEMBER(t, f) sizeof((reinterpret_cast<t*>(4096))->f)
#define OFFSETOF_MEMBER(t, f) \
(reinterpret_cast<char*>(&reinterpret_cast<t*>(16)->f) - reinterpret_cast<char*>(16))
@@ -126,8 +124,8 @@
#define PACKED __attribute__ ((__packed__))
-#define LIKELY(x) __builtin_expect((x),true)
-#define UNLIKELY(x) __builtin_expect((x),false)
+#define LIKELY(x) __builtin_expect((x), true)
+#define UNLIKELY(x) __builtin_expect((x), false)
// bionic and glibc both have TEMP_FAILURE_RETRY, but Mac OS' libc doesn't.
#ifndef TEMP_FAILURE_RETRY
diff --git a/src/object.h b/src/object.h
index 24adce1..7d8b768 100644
--- a/src/object.h
+++ b/src/object.h
@@ -1259,7 +1259,7 @@
// Depth of class from java.lang.Object
size_t Depth() {
size_t depth = 0;
- for(Class* klass = this; klass->GetSuperClass() != NULL; klass = klass->GetSuperClass()) {
+ for (Class* klass = this; klass->GetSuperClass() != NULL; klass = klass->GetSuperClass()) {
depth++;
}
return depth;
diff --git a/src/object_utils.h b/src/object_utils.h
index 3af7007..e2d9b88 100644
--- a/src/object_utils.h
+++ b/src/object_utils.h
@@ -232,7 +232,7 @@
class FieldHelper {
public:
FieldHelper() : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(NULL) {}
- FieldHelper(const Field* f) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(f) {}
+ explicit FieldHelper(const Field* f) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(f) {}
FieldHelper(const Field* f, ClassLinker* l) : class_linker_(l), dex_cache_(NULL), dex_file_(NULL),
field_(f) {}
@@ -370,7 +370,7 @@
public:
MethodHelper() : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), method_(NULL),
shorty_(NULL), shorty_len_(0) {}
- MethodHelper(const Method* m) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL),
+ explicit MethodHelper(const Method* m) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL),
method_(NULL), shorty_(NULL), shorty_len_(0) {
SetMethod(m);
}
diff --git a/src/runtime.h b/src/runtime.h
index 913779a..2b3fd7e 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -219,7 +219,7 @@
bool Init(const Options& options, bool ignore_unrecognized);
void InitNativeMethods();
- void RegisterRuntimeNativeMethods(JNIEnv*);
+ void RegisterRuntimeNativeMethods(JNIEnv* env);
void StartDaemonThreads();
void StartSignalCatcher();
diff --git a/src/signal_catcher.h b/src/signal_catcher.h
index 89132c9..8554531 100644
--- a/src/signal_catcher.h
+++ b/src/signal_catcher.h
@@ -31,7 +31,7 @@
*/
class SignalCatcher {
public:
- SignalCatcher(const std::string& stack_trace_file);
+ explicit SignalCatcher(const std::string& stack_trace_file);
~SignalCatcher();
void HandleSigQuit();
diff --git a/src/stack_indirect_reference_table.h b/src/stack_indirect_reference_table.h
index 0246419..5f37294 100644
--- a/src/stack_indirect_reference_table.h
+++ b/src/stack_indirect_reference_table.h
@@ -29,9 +29,8 @@
// the bridge frame between managed and native code backed by stack
// storage or manually allocated by SirtRef to hold one reference.
class StackIndirectReferenceTable {
-public:
-
- StackIndirectReferenceTable(Object* object) {
+ public:
+ explicit StackIndirectReferenceTable(Object* object) {
number_of_references_ = 1;
references_[0] = object;
Thread::Current()->PushSirt(this);
@@ -86,7 +85,7 @@
return OFFSETOF_MEMBER(StackIndirectReferenceTable, link_);
}
-private:
+ private:
StackIndirectReferenceTable() {}
size_t number_of_references_;
@@ -100,8 +99,8 @@
template<class T>
class SirtRef {
-public:
- SirtRef(T* object) : sirt_(object) {}
+ public:
+ explicit SirtRef(T* object) : sirt_(object) {}
~SirtRef() {}
T& operator*() const { return *get(); }
@@ -114,7 +113,7 @@
sirt_.SetReference(0, object);
}
-private:
+ private:
StackIndirectReferenceTable sirt_;
DISALLOW_COPY_AND_ASSIGN(SirtRef);
diff --git a/src/timing_logger.h b/src/timing_logger.h
index b60c60a..2809f0f 100644
--- a/src/timing_logger.h
+++ b/src/timing_logger.h
@@ -28,7 +28,7 @@
namespace art {
class TimingLogger {
-public:
+ public:
explicit TimingLogger(const char* name) : name_(name) {
AddSplit("");
}
@@ -46,7 +46,7 @@
LOG(INFO) << name_ << ": end, " << ToMs(times_.back() - times_.front()) << " ms";
}
-private:
+ private:
static uint64_t ToMs(uint64_t ns) {
return ns/1000/1000;
}