summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-01-24 18:12:29 -0800
committer Elliott Hughes <enh@google.com> 2012-01-24 18:12:29 -0800
commitff17f1fd3ff32f93e45588eb2b158832d73f9afa (patch)
treedeab04f6a2ad7f1dbaf0e6be266512d663e3dd91
parenta7679b67ca945194fa2442015e606cd250f0de2b (diff)
Remove various bits of lint.
Change-Id: I5f8f61766d2add7fd7ff40d463ea03cb20515988
-rw-r--r--src/atomic.cc2
-rw-r--r--src/calling_convention.h1
-rw-r--r--src/compiled_class.h5
-rw-r--r--src/context.h2
-rw-r--r--src/debugger.h2
-rw-r--r--src/dex_verifier.h6
-rw-r--r--src/image_writer.h2
-rw-r--r--src/macros.h10
-rw-r--r--src/object.h2
-rw-r--r--src/object_utils.h4
-rw-r--r--src/runtime.h2
-rw-r--r--src/signal_catcher.h2
-rw-r--r--src/stack_indirect_reference_table.h13
-rw-r--r--src/timing_logger.h4
14 files changed, 26 insertions, 31 deletions
diff --git a/src/atomic.cc b/src/atomic.cc
index 16d1934941..e5c10e4fa6 100644
--- a/src/atomic.cc
+++ b/src/atomic.cc
@@ -43,7 +43,7 @@ namespace art {
#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 bfd7d21ad3..bdbf1a1712 100644
--- a/src/calling_convention.h
+++ b/src/calling_convention.h
@@ -87,7 +87,6 @@ class CallingConvention {
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 98f0d9fcba..7dac93cebf 100644
--- a/src/compiled_class.h
+++ b/src/compiled_class.h
@@ -9,8 +9,8 @@ namespace art {
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 @@ class CompiledClass {
} // namespace art
#endif // ART_SRC_COMPILED_CLASS_H_
-
diff --git a/src/context.h b/src/context.h
index 75eb8ca8d5..292ac849e1 100644
--- a/src/context.h
+++ b/src/context.h
@@ -37,7 +37,7 @@ class Context {
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 f8657fe945..04066cdf76 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -70,7 +70,7 @@ struct DebugInvokeReq {
};
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 5ef62f5903..875b0539c1 100644
--- a/src/dex_verifier.h
+++ b/src/dex_verifier.h
@@ -695,7 +695,7 @@ class RegisterLine {
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 @@ class DexVerifier {
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 ad00f71381..d32724cbb0 100644
--- a/src/image_writer.h
+++ b/src/image_writer.h
@@ -22,7 +22,7 @@ namespace art {
// 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 5b9bdb6463..fc65564f05 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 @@ char (&ArraySizeHelper(T (&array)[N]))[N];
#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 @@ char (&ArraySizeHelper(T (&array)[N]))[N];
#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 24adce1632..7d8b7683b8 100644
--- a/src/object.h
+++ b/src/object.h
@@ -1259,7 +1259,7 @@ class MANAGED Class : public StaticStorageBase {
// 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 3af700762c..e2d9b88604 100644
--- a/src/object_utils.h
+++ b/src/object_utils.h
@@ -232,7 +232,7 @@ class ClassHelper {
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 @@ class MethodHelper {
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 913779a549..2b3fd7ee92 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -219,7 +219,7 @@ class Runtime {
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 89132c9cce..85545316e2 100644
--- a/src/signal_catcher.h
+++ b/src/signal_catcher.h
@@ -31,7 +31,7 @@ class Thread;
*/
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 0246419ace..5f372947e2 100644
--- a/src/stack_indirect_reference_table.h
+++ b/src/stack_indirect_reference_table.h
@@ -29,9 +29,8 @@ class Object;
// 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 @@ public:
return OFFSETOF_MEMBER(StackIndirectReferenceTable, link_);
}
-private:
+ private:
StackIndirectReferenceTable() {}
size_t number_of_references_;
@@ -100,8 +99,8 @@ private:
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 @@ public:
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 b60c60aff2..2809f0ff2a 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 @@ public:
LOG(INFO) << name_ << ": end, " << ToMs(times_.back() - times_.front()) << " ms";
}
-private:
+ private:
static uint64_t ToMs(uint64_t ns) {
return ns/1000/1000;
}