From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Fmx-0000O7-Nd for qemu-devel@nongnu.org; Wed, 17 Jun 2015 12:02:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5Fmt-0005Te-MR for qemu-devel@nongnu.org; Wed, 17 Jun 2015 12:02:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Fmt-0005TL-F4 for qemu-devel@nongnu.org; Wed, 17 Jun 2015 12:02:03 -0400 Message-ID: <558199F1.1090106@redhat.com> Date: Wed, 17 Jun 2015 10:01:53 -0600 From: Eric Blake MIME-Version: 1.0 References: <9d0c3109b26c78d7be59f54527255f2af81bc68b.1434458391.git.DirtY.iCE.hu@gmail.com> <87a8vyg3wi.fsf@blackfin.pond.sub.org> <55815474.6060909@gmail.com> <87r3pa7duh.fsf@blackfin.pond.sub.org> In-Reply-To: <87r3pa7duh.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FIFRlPuMqLpKcAling0uOoVB0XJRGKskq" Subject: Re: [Qemu-devel] [PATCH v2 5/6] audio: use qapi AudioFormat instead of audfmt_e List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , =?UTF-8?B?S8WRdsOhZ8OzIFpvbHTDoQ==?= =?UTF-8?B?bg==?= Cc: Peter Maydell , Michael Walle , qemu-devel@nongnu.org, Gerd Hoffmann This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FIFRlPuMqLpKcAling0uOoVB0XJRGKskq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/17/2015 05:51 AM, Markus Armbruster wrote: >>>> @@ -639,19 +639,22 @@ static int alsa_open (int in, struct alsa_para= ms_req *req, >>>> bytes_per_sec =3D freq << (nchannels =3D=3D 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. >=20 > 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FIFRlPuMqLpKcAling0uOoVB0XJRGKskq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVgZnxAAoJEKeha0olJ0NqZQkH/j63ututIlTV5UJIjhswdxOn QFMnQopIxPHc9T91YutcvQJWD68Eu2fSUIDxnKLNywnKH9UaDFZpC7ZSQ2pHjkIk CQsYN+Edjv5nOYAulV672DK6oQ5gKNS8Ywm01sL6XpHeptM7nmuCRKurdf0Sa5U0 lpHfnmylr3qN8RhjSGUMFkgKo/6kETvBeMGdBrHxSf1kiQ579dMm413CxdOw/rjr 7qifybQ8NUljdEz1SiOfG89AedMzs8N0SNz32V41jXIwQipG5Wefb7O/CxfshMHJ O+6nlNRi7zkRk5yWQjuqKqkr3Ia980LgONnq3WHVEEdi8VKBAmEn6LtJQlbTnXI= =nVUu -----END PGP SIGNATURE----- --FIFRlPuMqLpKcAling0uOoVB0XJRGKskq--