Blue Swirl <blauwir...@gmail.com> writes: > On 5/11/10, Markus Armbruster <arm...@redhat.com> wrote: >> Blue Swirl <blauwir...@gmail.com> writes: >> >> > On 5/9/10, chen huacai <zltjiang...@gmail.com> wrote: >> >> This patch add initial support of VIA IDE controller used by fulong mini >> pc >> >> >> >> Signed-off-by: Huacai Chen <zltjiang...@gmail.com> >> >> ----- >> [...] >> >> >> diff --git a/hw/ide/via.c b/hw/ide/via.c >> >> new file mode 100644 >> >> index 0000000..9adc5b5 >> >> --- /dev/null >> >> +++ b/hw/ide/via.c >> >> @@ -0,0 +1,189 @@ >> >> [...] >> >> >> +static void bmdma_writeb(void *opaque, uint32_t addr, uint32_t val) >> >> +{ >> >> + BMDMAState *bm = opaque; >> >> +#ifdef DEBUG_IDE >> >> + printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val); >> >> +#endif >> >> + switch(addr & 3) { >> >> + case 2: >> >> + bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & >> >> ~val & 0x06); >> >> + break; >> > >> > Some gccs complain if there is no default case. >> >> >> Are you sure? Which version? >> >> It warns when the switch expression's type is an enumeration, and the >> switch doesn't handle all enumeration constants, and has no default >> case. >> >> I can be made to warn whenever there's no default, but we don't do that. > > This problem came up with 299b520cd4092be3c53f8380b81315c33927d9d3 > (fixed before commit) and 4450521668471c7685551d8c5bcc582d754e9843, > with mingw gcc and OpenBSD gccs. [...] > > Maybe those cases were different from this.
The first commit you quoted is indeed different: the default prevents a spurious warning: ‘context’ may be used uninitialized in this function from some versions of gcc. No such confusion can arise here. In the second one, the switch expression is of enumeration type.