Cleanup: Remove 100+ compiler warnings.

This is a big cleanup that removes compiler warnings by performing
the following:

- Remove unused functions or variables.
- Change pointer cast to be alias safe using unions.
- Use __attribute__((unused)) on some local variable definitions
  when their usage depends on conditional defines that are not
  always true when compiling the same source several times.
- Fix a couple array indexing bugs.

There are still a few warnings from the JSON lexer, libjpeg and
the TCG helpers though, but the overall compilation is much cleaner.

BUG=NONE

Change-Id: Ic4483e6402b266ecfd7bca8c92a73d8fcf392a1f
diff --git a/target-mips/helper.c b/target-mips/helper.c
index fe97355..7de79d1 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -340,6 +340,9 @@
     return ldl_phys(linux_pte_info.pgd_current_p);
 }
 
+// in target-mips/op_helper.c
+extern void r4k_helper_ptw_tlbrefill(CPUState*);
+
 static inline int cpu_mips_tlb_refill(CPUState *env, target_ulong address, int rw ,
                                       int mmu_idx, int is_softmmu)
 {
@@ -347,9 +350,8 @@
     target_ulong saved_badvaddr,saved_entryhi,saved_context;
 
     target_ulong pgd_addr,pt_addr,index;
-    target_ulong fault_addr,ptw_phys;
+    target_ulong fault_addr, ptw_phys;
     target_ulong elo_even,elo_odd;
-    uint32_t page_valid;
     int ret;
 
     saved_badvaddr = env->CP0_BadVAddr;
@@ -366,7 +368,6 @@
     env->hflags = MIPS_HFLAG_KM;
 
     fault_addr = env->CP0_BadVAddr;
-    page_valid = 0;
 
     pgd_addr = cpu_mips_get_pgd(env);
     if (unlikely(!pgd_addr))
@@ -442,7 +443,7 @@
     hwaddr physical;
     int prot;
 #endif
-    int exception = 0, error_code = 0;
+    //int exception = 0, error_code = 0;
     int access_type;
     int ret = 0;