qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 14/15] Use gcc warning flag -Wempty-body, fix warnings
@ 2010-09-05 15:07 Blue Swirl
  2010-09-05 17:54 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2010-09-05 15:07 UTC (permalink / raw)
  To: qemu-devel

If the compiler supports the warning flag -Wempty-body, use it.

Adjust the code to avoid the warnings.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 configure         |    2 +-
 hw/omap_i2c.c     |    5 +++--
 hw/omap_mmc.c     |    5 +++--
 hw/pxa2xx.c       |    5 +++--
 hw/soc_dma.c      |    5 +++--
 target-cris/mmu.c |    2 +-
 6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 6e4917a..61626b8 100755
--- a/configure
+++ b/configure
@@ -140,7 +140,7 @@ LDFLAGS="-g $LDFLAGS"

 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers $gcc_flags"
-gcc_flags="-Wmissing-include-dirs -Wclobbered $gcc_flags"
+gcc_flags="-Wmissing-include-dirs -Wclobbered -Wempty-body $gcc_flags"
 gcc_flags="-fstack-protector-all $gcc_flags"
 cat > $TMPC << EOF
 int main(void) { return 0; }
diff --git a/hw/omap_i2c.c b/hw/omap_i2c.c
index d7c1888..d133977 100644
--- a/hw/omap_i2c.c
+++ b/hw/omap_i2c.c
@@ -190,8 +190,9 @@ static uint32_t omap_i2c_read(void *opaque,
target_phys_addr_t addr)
             if (s->rxlen > 2)
                 s->fifo >>= 16;
             s->rxlen -= 2;
-        } else
-            /* XXX: remote access (qualifier) error - what's that?  */;
+        } else {
+            /* XXX: remote access (qualifier) error - what's that?  */
+        }
         if (!s->rxlen) {
             s->stat &= ~(1 << 3);				/* RRDY */
             if (((s->control >> 10) & 1) &&			/* MST */
diff --git a/hw/omap_mmc.c b/hw/omap_mmc.c
index 15cbf06..9d167ff 100644
--- a/hw/omap_mmc.c
+++ b/hw/omap_mmc.c
@@ -559,8 +559,9 @@ static void omap_mmc_cover_cb(void *opaque, int
line, int level)
     if (!host->cdet_state && level) {
         host->status |= 0x0002;
         omap_mmc_interrupts_update(host);
-        if (host->cdet_wakeup)
-            /* TODO: Assert wake-up */;
+        if (host->cdet_wakeup) {
+            /* TODO: Assert wake-up */
+        }
     }

     if (host->cdet_state != level) {
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index 88f61c0..6e04645 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -1877,8 +1877,9 @@ static void pxa2xx_fir_write(void *opaque,
target_phys_addr_t addr,
         s->control[0] = value;
         if (!(value & (1 << 4)))			/* RXE */
             s->rx_len = s->rx_start = 0;
-        if (!(value & (1 << 3)))			/* TXE */
-            /* Nop */;
+        if (!(value & (1 << 3))) {                      /* TXE */
+            /* Nop */
+        }
         s->enable = value & 1;				/* ITR */
         if (!s->enable)
             s->status[0] = 0;
diff --git a/hw/soc_dma.c b/hw/soc_dma.c
index e116e63..23ec516 100644
--- a/hw/soc_dma.c
+++ b/hw/soc_dma.c
@@ -192,12 +192,13 @@ static void soc_dma_ch_freq_update(struct dma_s *s)
     if (s->enabled_count)
         /* We completely ignore channel priorities and stuff */
         s->channel_freq = s->soc.freq / s->enabled_count;
-    else
+    else {
         /* TODO: Signal that we want to disable the functional clock and let
          * the platform code decide what to do with it, i.e. check that
          * auto-idle is enabled in the clock controller and if we are stopping
          * the clock, do the same with any parent clocks that had only one
-         * user keeping them on and auto-idle enabled.  */;
+         * user keeping them on and auto-idle enabled.  */
+    }
 }

 void soc_dma_set_request(struct soc_dma_ch_s *ch, int level)
diff --git a/target-cris/mmu.c b/target-cris/mmu.c
index 773438e..3f290ba 100644
--- a/target-cris/mmu.c
+++ b/target-cris/mmu.c
@@ -33,7 +33,7 @@
 #define D(x) x
 #define D_LOG(...) qemu_log(__VA_ARGS__)
 #else
-#define D(x)
+#define D(x) do { } while (0)
 #define D_LOG(...) do { } while (0)
 #endif

-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH 14/15] Use gcc warning flag -Wempty-body, fix warnings
  2010-09-05 15:07 [Qemu-devel] [PATCH 14/15] Use gcc warning flag -Wempty-body, fix warnings Blue Swirl
@ 2010-09-05 17:54 ` Michael S. Tsirkin
  2010-09-05 19:24   ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-09-05 17:54 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On Sun, Sep 05, 2010 at 03:07:23PM +0000, Blue Swirl wrote:
> diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
> index 88f61c0..6e04645 100644
> --- a/hw/pxa2xx.c
> +++ b/hw/pxa2xx.c
> @@ -1877,8 +1877,9 @@ static void pxa2xx_fir_write(void *opaque,
> target_phys_addr_t addr,
>          s->control[0] = value;
>          if (!(value & (1 << 4)))			/* RXE */
>              s->rx_len = s->rx_start = 0;
> -        if (!(value & (1 << 3)))			/* TXE */
> -            /* Nop */;
> +        if (!(value & (1 << 3))) {                      /* TXE */
> +            /* Nop */
> +        }

Should we change the surrounding code to use {} to keep it consistent?
It's annoying to have {} in one place only.

>          s->enable = value & 1;				/* ITR */
>          if (!s->enable)
>              s->status[0] = 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH 14/15] Use gcc warning flag -Wempty-body, fix warnings
  2010-09-05 17:54 ` [Qemu-devel] " Michael S. Tsirkin
@ 2010-09-05 19:24   ` Blue Swirl
  0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2010-09-05 19:24 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sun, Sep 5, 2010 at 5:54 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Sun, Sep 05, 2010 at 03:07:23PM +0000, Blue Swirl wrote:
>> diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
>> index 88f61c0..6e04645 100644
>> --- a/hw/pxa2xx.c
>> +++ b/hw/pxa2xx.c
>> @@ -1877,8 +1877,9 @@ static void pxa2xx_fir_write(void *opaque,
>> target_phys_addr_t addr,
>>          s->control[0] = value;
>>          if (!(value & (1 << 4)))                     /* RXE */
>>              s->rx_len = s->rx_start = 0;
>> -        if (!(value & (1 << 3)))                     /* TXE */
>> -            /* Nop */;
>> +        if (!(value & (1 << 3))) {                      /* TXE */
>> +            /* Nop */
>> +        }
>
> Should we change the surrounding code to use {} to keep it consistent?
> It's annoying to have {} in one place only.

In other reviews, changes like that have been called unrelated.

>
>>          s->enable = value & 1;                               /* ITR */
>>          if (!s->enable)
>>              s->status[0] = 0;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-05 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-05 15:07 [Qemu-devel] [PATCH 14/15] Use gcc warning flag -Wempty-body, fix warnings Blue Swirl
2010-09-05 17:54 ` [Qemu-devel] " Michael S. Tsirkin
2010-09-05 19:24   ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).