All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] Fix remaining compiler warnings for mips targets
Date: Fri, 19 Dec 2008 21:41:57 +0100	[thread overview]
Message-ID: <494C0715.2030307@mail.berlios.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

This patch allows compilation of mips targets using compiler option -Werror.
I had to change these code locations to fix all compiler warnings:

* Move some declarations from target-mips/exec.h to target-mips/cpu.h.
* Use cpu_loop_exit() in cpu-exec.c (like other targets). This is also
an optimization.
* Declare several functions static in mips-dis.c and put unused code in
#if 0 ... #endif.
* Remove unused code in target-mips/helper.c.
* More code in target-mips/op_helper.c is only needed for system emulation.

The patch does not add the option -Werror because I noticed that
this was reverted for other Qemu targets (r6030).

Regards
Stefan Weil



[-- Attachment #2: fix-mips-warnings.patch --]
[-- Type: text/x-diff, Size: 5189 bytes --]

fix remaining compiler warnings for mips targets

Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Index: trunk/cpu-exec.c
===================================================================
--- trunk.orig/cpu-exec.c	2008-12-19 20:54:31.000000000 +0100
+++ trunk/cpu-exec.c	2008-12-19 20:54:40.000000000 +0100
@@ -1008,7 +1008,7 @@
     /* we restore the process signal mask as the sigreturn should
        do it (XXX: use sigsetjmp) */
         sigprocmask(SIG_SETMASK, old_set, NULL);
-        do_raise_exception_err(env->exception_index, env->error_code);
+        cpu_loop_exit();
     } else {
         /* activate soft MMU for this block */
         cpu_resume_from_signal(env, puc);
Index: trunk/target-mips/cpu.h
===================================================================
--- trunk.orig/target-mips/cpu.h	2008-12-19 20:54:31.000000000 +0100
+++ trunk/target-mips/cpu.h	2008-12-19 21:19:32.000000000 +0100
@@ -561,9 +561,26 @@
 
 int cpu_mips_exec(CPUMIPSState *s);
 CPUMIPSState *cpu_mips_init(const char *cpu_model);
-uint32_t cpu_mips_get_clock (void);
+//~ uint32_t cpu_mips_get_clock (void);
 int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
 
+/* mips_timer.c */
+uint32_t cpu_mips_get_random (CPUState *env);
+uint32_t cpu_mips_get_count (CPUState *env);
+void cpu_mips_store_count (CPUState *env, uint32_t value);
+void cpu_mips_store_compare (CPUState *env, uint32_t value);
+void cpu_mips_start_count(CPUState *env);
+void cpu_mips_stop_count(CPUState *env);
+
+/* mips_int.c */
+void cpu_mips_update_irq (CPUState *env);
+
+/* helper.c */
+int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
+                               int mmu_idx, int is_softmmu);
+void do_interrupt (CPUState *env);
+void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra);
+
 static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
 {
     env->active_tc.PC = tb->pc;
Index: trunk/target-mips/exec.h
===================================================================
--- trunk.orig/target-mips/exec.h	2008-12-19 20:54:31.000000000 +0100
+++ trunk/target-mips/exec.h	2008-12-19 20:54:40.000000000 +0100
@@ -24,21 +24,6 @@
                     int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags);
 
-int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
-                               int mmu_idx, int is_softmmu);
-void do_interrupt (CPUState *env);
-void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra);
-
-void do_raise_exception_err (uint32_t exception, int error_code);
-void do_raise_exception (uint32_t exception);
-
-uint32_t cpu_mips_get_random (CPUState *env);
-uint32_t cpu_mips_get_count (CPUState *env);
-void cpu_mips_store_count (CPUState *env, uint32_t value);
-void cpu_mips_store_compare (CPUState *env, uint32_t value);
-void cpu_mips_start_count(CPUState *env);
-void cpu_mips_stop_count(CPUState *env);
-void cpu_mips_update_irq (CPUState *env);
 void cpu_mips_clock_init (CPUState *env);
 void cpu_mips_tlb_flush (CPUState *env, int flush_global);
 
Index: trunk/mips-dis.c
===================================================================
--- trunk.orig/mips-dis.c	2008-12-19 20:54:31.000000000 +0100
+++ trunk/mips-dis.c	2008-12-19 20:54:40.000000000 +0100
@@ -3272,7 +3272,7 @@
   return c;
 }
 
-void
+static void
 set_default_mips_dis_options (struct disassemble_info *info)
 {
   const struct mips_arch_choice *chosen_arch;
@@ -3321,7 +3321,7 @@
 #endif
 }
 
-void
+static void
 parse_mips_dis_option (const char *option, unsigned int len)
 {
   unsigned int i, optionlen, vallen;
@@ -4809,7 +4809,6 @@
       abort ();
     }
 }
-#endif
 
 void
 print_mips_disassembler_options (FILE *stream)
@@ -4863,3 +4862,4 @@
 
   fprintf (stream, _("\n"));
 }
+#endif
Index: trunk/target-mips/helper.c
===================================================================
--- trunk.orig/target-mips/helper.c	2008-12-19 20:54:31.000000000 +0100
+++ trunk/target-mips/helper.c	2008-12-19 20:54:40.000000000 +0100
@@ -220,10 +220,6 @@
     }
 }
 
-void cpu_mips_init_mmu (CPUState *env)
-{
-}
-
 int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
                                int mmu_idx, int is_softmmu)
 {
Index: trunk/target-mips/op_helper.c
===================================================================
--- trunk.orig/target-mips/op_helper.c	2008-12-19 20:54:31.000000000 +0100
+++ trunk/target-mips/op_helper.c	2008-12-19 21:14:04.000000000 +0100
@@ -54,7 +54,8 @@
     }
 }
 
-void do_restore_state (void *pc_ptr)
+#if !defined(CONFIG_USER_ONLY)
+static void do_restore_state (void *pc_ptr)
 {
     TranslationBlock *tb;
     unsigned long pc = (unsigned long) pc_ptr;
@@ -64,6 +65,7 @@
         cpu_restore_state (tb, env, pc, NULL);
     }
 }
+#endif
 
 target_ulong do_clo (target_ulong t0)
 {
@@ -1356,7 +1358,6 @@
 {
     fprintf(logfile, "Raise pending IRQs\n");
 }
-#endif /* !CONFIG_USER_ONLY */
 
 /* MIPS MT functions */
 target_ulong do_mftgpr(uint32_t sel)
@@ -1495,6 +1496,7 @@
 
     return t0;
 }
+#endif /* !CONFIG_USER_ONLY */
 
 void do_fork(target_ulong t0, target_ulong t1)
 {

                 reply	other threads:[~2008-12-19 20:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=494C0715.2030307@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.