Syntax clean up to make clang happy.

Change-Id: I0984c395bbd1ee4b206eafd19915b6f68781dd16
diff --git a/src/compiler.cc b/src/compiler.cc
index c34b7d8..b06f718 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1003,7 +1003,7 @@
   const CompilationContext* const context_;
   const size_t begin_;
   const size_t end_;
-  const Callback* callback_;
+  Callback* callback_;
   const size_t stripe_;
 
   friend void ForAll(CompilationContext*, size_t, size_t, Callback, size_t);
diff --git a/src/debugger.h b/src/debugger.h
index 4db9bd7..6e82001 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -31,7 +31,7 @@
 namespace art {
 
 struct AllocRecord;
-struct Thread;
+class Thread;
 
 /*
  * Invoke-during-breakpoint support.
diff --git a/src/dex_instruction_visitor.h b/src/dex_instruction_visitor.h
index 2808c97..d625b64 100644
--- a/src/dex_instruction_visitor.h
+++ b/src/dex_instruction_visitor.h
@@ -61,7 +61,7 @@
 #undef INSTRUCTION_VISITOR
 
   // The default instruction handler.
-  void Do_Default(const Instruction* inst) {
+  void Do_Default(const Instruction*) {
     return;
   }
 };
diff --git a/src/image_writer.cc b/src/image_writer.cc
index 969f4ab..bc22af6 100644
--- a/src/image_writer.cc
+++ b/src/image_writer.cc
@@ -481,7 +481,7 @@
   // Every type of method can have an invoke stub
   uint32_t invoke_stub_offset = orig->GetOatInvokeStubOffset();
   const byte* invoke_stub = GetOatAddress(invoke_stub_offset);
-  copy->invoke_stub_ = reinterpret_cast<const Method::InvokeStub*>(invoke_stub);
+  copy->invoke_stub_ = reinterpret_cast<Method::InvokeStub*>(const_cast<byte*>(invoke_stub));
 
   if (orig->IsAbstract()) {
     // Abstract methods are pointed to a stub that will throw AbstractMethodError if they are called
diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h
index b80033c..725e857 100644
--- a/src/jdwp/jdwp.h
+++ b/src/jdwp/jdwp.h
@@ -31,8 +31,8 @@
 
 namespace art {
 
-struct Method;
-struct Thread;
+class Method;
+class Thread;
 
 namespace JDWP {
 
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index dbdc149..ab2286f 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -1162,7 +1162,7 @@
     ScopedObjectAccess soa(env);
     va_list ap;
     va_start(ap, mid);
-    JValue result(InvokeVirtualOrInterfaceWithVarArgs(soa, obj, mid, ap));
+    InvokeVirtualOrInterfaceWithVarArgs(soa, obj, mid, ap);
     va_end(ap);
   }
 
diff --git a/src/oat/runtime/x86/runtime_support_x86.S b/src/oat/runtime/x86/runtime_support_x86.S
index d8098b6..45caaae 100644
--- a/src/oat/runtime/x86/runtime_support_x86.S
+++ b/src/oat/runtime/x86/runtime_support_x86.S
@@ -422,7 +422,7 @@
     pushl %ecx                    // pass arg2 b
     pushl %eax                    // pass arg1 a
     call SYMBOL(fmodf)            // (jfloat a, jfloat b)
-    fstp  (%esp)                  // pop return value off fp stack
+    fstps (%esp)                  // pop return value off fp stack
     movss (%esp), %xmm0           // place into %xmm0
     addl LITERAL(12), %esp        // pop arguments
     ret
@@ -442,7 +442,7 @@
     pushl %ecx                    // pass arg2 a.hi
     pushl %eax                    // pass arg1 a.lo
     call SYMBOL(art_l2f)          // (jlong a)
-    fstp  (%esp)                  // pop return value off fp stack
+    fstps (%esp)                  // pop return value off fp stack
     movss (%esp), %xmm0           // place into %xmm0
     addl LITERAL(12), %esp        // pop arguments
     ret
@@ -819,8 +819,8 @@
     ret
     .balign 16
 not_equal:
-    movzxw  -2(%esi), %eax        // get last compared char from this string
-    movzxw  -2(%edi), %ecx        // get last compared char from comp string
+    movzwl  -2(%esi), %eax        // get last compared char from this string
+    movzwl  -2(%edi), %ecx        // get last compared char from comp string
     subl  %ecx, %eax              // return the difference
     popl  %edi                    // pop callee save reg
     popl  %esi                    // pop callee save reg
diff --git a/src/oat_file.cc b/src/oat_file.cc
index 6f96e98..264405d 100644
--- a/src/oat_file.cc
+++ b/src/oat_file.cc
@@ -334,8 +334,9 @@
   return reinterpret_cast<uint32_t*>(code)[-1];
 }
 
-const Method::InvokeStub* OatFile::OatMethod::GetInvokeStub() const {
-  return GetOatPointer<const Method::InvokeStub*>(invoke_stub_offset_);
+Method::InvokeStub* OatFile::OatMethod::GetInvokeStub() const {
+  const byte* stub = GetOatPointer<const byte*>(invoke_stub_offset_);
+  return reinterpret_cast<Method::InvokeStub*>(const_cast<byte*>(stub));
 }
 
 uint32_t OatFile::OatMethod::GetInvokeStubSize() const {
diff --git a/src/oat_file.h b/src/oat_file.h
index 856a033..24b6b40 100644
--- a/src/oat_file.h
+++ b/src/oat_file.h
@@ -108,7 +108,7 @@
       return GetOatPointer<const uint8_t*>(gc_map_offset_);
     }
 
-    const Method::InvokeStub* GetInvokeStub() const;
+    Method::InvokeStub* GetInvokeStub() const;
     uint32_t GetInvokeStubSize() const;
 
 #if defined(ART_USE_LLVM_COMPILER)
diff --git a/src/object.cc b/src/object.cc
index dd984fc..c8da0fa 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -526,7 +526,7 @@
 
   // Call the invoke stub associated with the method.
   // Pass everything as arguments.
-  const Method::InvokeStub* stub = GetInvokeStub();
+  Method::InvokeStub* stub = GetInvokeStub();
 
   bool have_executable_code = (GetCode() != NULL);
 
diff --git a/src/object.h b/src/object.h
index 03ed132..dfb34e0 100644
--- a/src/object.h
+++ b/src/object.h
@@ -546,7 +546,7 @@
 // C++ mirror of java.lang.reflect.Method and java.lang.reflect.Constructor
 class MANAGED Method : public Object {
  public:
-  // An function that invokes a method with an array of its arguments.
+  // A function that invokes a method with an array of its arguments.
   typedef void InvokeStub(const Method* method,
                           Object* obj,
                           Thread* thread,
@@ -857,7 +857,7 @@
   }
 
   // Native to managed invocation stub entry point
-  const InvokeStub* GetInvokeStub() const {
+  InvokeStub* GetInvokeStub() const {
     InvokeStub* result = GetFieldPtr<InvokeStub*>(
         OFFSET_OF_OBJECT_MEMBER(Method, invoke_stub_), false);
     // TODO: DCHECK(result != NULL);  should be ahead of time compiled
@@ -865,8 +865,8 @@
   }
 
   void SetInvokeStub(InvokeStub* invoke_stub) {
-    SetFieldPtr<const InvokeStub*>(OFFSET_OF_OBJECT_MEMBER(Method, invoke_stub_),
-                                   invoke_stub, false);
+    SetFieldPtr<InvokeStub*>(OFFSET_OF_OBJECT_MEMBER(Method, invoke_stub_),
+                             invoke_stub, false);
   }
 
   uint32_t GetInvokeStubSize() const {
@@ -1010,7 +1010,7 @@
   const uint8_t* gc_map_;
 
   // Native invocation stub entry point for calling from native to managed code.
-  const InvokeStub* invoke_stub_;
+  InvokeStub* invoke_stub_;
 
   // Mapping from native pc to dex pc
   const uint32_t* mapping_table_;
diff --git a/src/runtime.cc b/src/runtime.cc
index 5230b774..60cc6f5 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -485,13 +485,14 @@
     } else if (StartsWith(option, "-Xstacktracefile:")) {
       parsed->stack_trace_file_ = option.substr(strlen("-Xstacktracefile:"));
     } else if (option == "sensitiveThread") {
-      parsed->hook_is_sensitive_thread_ = reinterpret_cast<bool (*)()>(options[i].second);
+      parsed->hook_is_sensitive_thread_ = reinterpret_cast<bool (*)()>(const_cast<void*>(options[i].second));
     } else if (option == "vfprintf") {
-      parsed->hook_vfprintf_ = reinterpret_cast<int (*)(FILE *, const char*, va_list)>(options[i].second);
+      parsed->hook_vfprintf_ =
+          reinterpret_cast<int (*)(FILE *, const char*, va_list)>(const_cast<void*>(options[i].second));
     } else if (option == "exit") {
-      parsed->hook_exit_ = reinterpret_cast<void(*)(jint)>(options[i].second);
+      parsed->hook_exit_ = reinterpret_cast<void(*)(jint)>(const_cast<void*>(options[i].second));
     } else if (option == "abort") {
-      parsed->hook_abort_ = reinterpret_cast<void(*)()>(options[i].second);
+      parsed->hook_abort_ = reinterpret_cast<void(*)()>(const_cast<void*>(options[i].second));
     } else if (option == "host-prefix") {
       parsed->host_prefix_ = reinterpret_cast<const char*>(options[i].second);
     } else if (option == "-Xgenregmap" || option == "-Xgc:precise") {
diff --git a/src/runtime.h b/src/runtime.h
index 3b9919c..f613991 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -47,7 +47,7 @@
 class DexFile;
 class Heap;
 class InternTable;
-class JavaVMExt;
+struct JavaVMExt;
 class Method;
 class MonitorList;
 class SignalCatcher;
diff --git a/src/thread.h b/src/thread.h
index efa92f4..499527a 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -46,7 +46,7 @@
 class ClassLinker;
 class ClassLoader;
 class Context;
-class DebugInvokeReq;
+struct DebugInvokeReq;
 class Method;
 class Monitor;
 class Object;