qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Markus Armbruster" <armbru@redhat.com>,
	"Kővágó Zoltán" <dirty.ice.hu@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Michael Walle <michael@walle.cc>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 5/6] audio: use qapi AudioFormat instead of audfmt_e
Date: Wed, 17 Jun 2015 10:01:53 -0600	[thread overview]
Message-ID: <558199F1.1090106@redhat.com> (raw)
In-Reply-To: <87r3pa7duh.fsf@blackfin.pond.sub.org>

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

On 06/17/2015 05:51 AM, Markus Armbruster wrote:

>>>> @@ -639,19 +639,22 @@ static int alsa_open (int in, struct alsa_params_req *req,
>>>>           bytes_per_sec = freq << (nchannels == 2);
>>>>
>>>>           switch (obt->fmt) {
>>>> -        case AUD_FMT_S8:
>>>> -        case AUD_FMT_U8:
>>>> +        case AUDIO_FORMAT_S8:
>>>> +        case AUDIO_FORMAT_U8:

>>>> +
>>>> +        case AUDIO_FORMAT_MAX:
>>>> +            break;
>>>
>>> Can this happen?
>>
>> Not under normal circumstances, but gcc warns otherwise.
> 
> Okay, sounds like another case of "default: abort();" to me :)

gcc has the annoying habit that it can warn you about missing enum
labels in a switch statement, but ONLY if you do not use a 'default:'
label.  Warning about missing labels is nice if you plan to add more
enum values down the road (then the compiler helpfully points out all
the code spots that need to deal with the new value) but with the
drawback that non-enum values bypass the switch completely.  So if you
anticipate this set growing, then s/break/abort()/ is all the more you
need.  On the other hand, if the set is pretty much fixed, then
switching to default: covers more cases including non-enum values
assigned into obt->fmt.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-06-17 16:02 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 12:49 [Qemu-devel] [PATCH v2 0/6] -audiodev option Kővágó, Zoltán
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 1/6] qapi: qapi for audio backends Kővágó, Zoltán
2015-06-17  7:46   ` Markus Armbruster
2015-06-17 10:54     ` Kővágó Zoltán
2015-06-17 11:48       ` Markus Armbruster
2015-06-17 12:07         ` Kővágó Zoltán
2015-06-17 13:37           ` Markus Armbruster
2015-06-17 13:53             ` Kővágó Zoltán
2015-06-17 16:06               ` Markus Armbruster
2015-06-18  0:21                 ` Kővágó Zoltán
2015-06-18  8:51                   ` Markus Armbruster
2015-06-17 15:50         ` Eric Blake
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 2/6] qapi: support nested structs in OptsVisitor Kővágó, Zoltán
2015-06-17  7:50   ` Markus Armbruster
2015-06-17  8:41     ` Gerd Hoffmann
2015-06-17 11:01       ` Kővágó Zoltán
2015-06-17 11:50         ` Markus Armbruster
2015-06-17 15:47         ` Eric Blake
2015-06-17 11:18       ` Markus Armbruster
2015-06-17 12:11         ` Kővágó Zoltán
2015-06-17 13:41           ` Markus Armbruster
2015-06-17 14:02             ` Kővágó Zoltán
2015-06-17 16:10               ` Markus Armbruster
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 3/6] opts: do not print separator before first item in qemu_opts_print Kővágó, Zoltán
2015-06-17  7:53   ` Markus Armbruster
2015-06-17  9:02   ` Kevin Wolf
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 4/6] qapi: AllocVisitor Kővágó, Zoltán
2015-06-17  7:56   ` Markus Armbruster
2015-06-17 12:01     ` Kővágó Zoltán
2015-06-17 13:42       ` Markus Armbruster
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 5/6] audio: use qapi AudioFormat instead of audfmt_e Kővágó, Zoltán
2015-06-17  8:01   ` Markus Armbruster
2015-06-17 11:05     ` Kővágó Zoltán
2015-06-17 11:51       ` Markus Armbruster
2015-06-17 16:01         ` Eric Blake [this message]
2015-06-16 12:49 ` [Qemu-devel] [PATCH v2 6/6] audio: -audiodev command line option Kővágó, Zoltán
2015-06-17  8:13   ` Markus Armbruster
2015-06-17 11:18     ` Kővágó Zoltán
2015-06-17 12:27       ` Markus Armbruster
2015-06-17 13:25         ` Kővágó Zoltán
2015-06-17 16:13           ` Markus Armbruster
2015-06-18  6:54             ` Gerd Hoffmann

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=558199F1.1090106@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dirty.ice.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=michael@walle.cc \
    --cc=peter.maydell@linaro.org \
    --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 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).