Received: by 10.223.164.202 with SMTP id h10csp4090746wrb; Wed, 29 Nov 2017 00:22:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMbxlWcPi+sPsA2KMwMIxH+bAHp/+x8LyGj4XqJyv5t9DRgY1Fsk6EKpaSr3Sa0ETQzjCu3X X-Received: by 10.99.112.78 with SMTP id a14mr1973509pgn.302.1511943759386; Wed, 29 Nov 2017 00:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511943759; cv=none; d=google.com; s=arc-20160816; b=eJPLG66KqTt8GpIQW/6bblrVjf+PqcPSecERVtWYYCjr5Im4EtYmQA2/ldqcfaVigT iH07eb7PkKXYULMFnLVj03nBsOetoOTB0dfreA9KeIqhu4Isie8t87MMJYcEodB1E+TV +4HHprJN4y8p4Pe+EvNxSz09MQkFGd0ylmRJhwknvQ7Y0DdwnyTLXd9he+mxx8xWkMXW lEDsdc3ZLQ+U0e/ANnq7px1UY+i4dLRsx/DyBFLMYF0P7nhio3NCR3cRhVs0DTilh+l0 cfxrw0A0l/hetmL0fFfXY3QQhiTRg2JfRgCu1Ara9uN01+XroaxKLns/b1zXQ4ZrKaRH W9JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=IryQnlkXY++59tJCrZonUBdFfdC9+/b1axj8R3FbPsI=; b=t5B95d6ixapvC7UjccrGHSnzUNGt9C1CLNheiF2IAr90qFQO35BGqqSQqJOncr+c/S jztG1So+visWymFrVfpFQB5wWTqrk4NFuvMAuJoG6RUcD+3QuyayJ8JT88Vn5mWItt14 /ju47mhE6q8k/Yd4eVRtjRtuxAqseylSo3SvPpi6ldhfoRnLM947n7s9o6QMae/BJoOP Pg55HOup9P2XFhHaS150pPzPKpHMhprYKNZGZoFi/WsleZWL0+ffiu3l/4RbBvJqx4CQ GXAg7iD8AnE9P2W1dnKSkzzUoDORCNQ6WHUBGDVhMkjghZp+1cnA/erWVRHEBMnDemuh W3xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HG0HvDan; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m184si939440pfb.373.2017.11.29.00.22.28; Wed, 29 Nov 2017 00:22:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HG0HvDan; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752924AbdK2IUR (ORCPT + 71 others); Wed, 29 Nov 2017 03:20:17 -0500 Received: from mail-qk0-f172.google.com ([209.85.220.172]:39221 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752530AbdK2IUP (ORCPT ); Wed, 29 Nov 2017 03:20:15 -0500 Received: by mail-qk0-f172.google.com with SMTP id u184so3333970qkd.6 for ; Wed, 29 Nov 2017 00:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IryQnlkXY++59tJCrZonUBdFfdC9+/b1axj8R3FbPsI=; b=HG0HvDanReUvuQgDkEjjyB8GbGEfBJEZK6zzc2hKs9XdQxriBjbICbBMJt53Sixne9 q0KHtuVzBjYX/tzUkY+j1uFrM/L41rz5D1b0o5CO3VbiZoeFOi9t8aeYqp8WGue9z7i/ d4byoKgSl2qAD2/tTx0jgHMNmYo898C73K3QfgKRLWVcTQaE0JN8ei1+HVRw2ohR0O5r maAxV7lPop0OMJoR5DnT7oB6Gl145b/7IvjlY+hc7lVDMLM8VdWXOB3RXaP1pA2xSUrl 15oC9LmO98fGYlGJhLOv1x/j/EeQNCyvSFVYPsza7Yii8pbDP74miD3bn1LBD2f17gQI dsRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IryQnlkXY++59tJCrZonUBdFfdC9+/b1axj8R3FbPsI=; b=e3fQkCosgowy6j0ncbNJa29ql2NJm8trWXJmWfTplE4WjZdUk4SYWGO+Ycho5q4/ma VghUvulYM9NlcP0jQyAC5ahSpoW6EGndxrm0MNBQZ30z1ZoVU/Bhquk95fOx0sdNxzi7 KvOtHF4SFToBJ+zZUMAhYNAThBDlrxWMLwHFPFTOgQ1Ph0+efTwDVnEwbZCA2mIt/j9v 4aS602y7+Fnk8gOFphYs78SIiDMB/LclIQb6ch9qfst5N3o716AezfE5EdKry7vV5lZI uPyirN18cd4laIZvkx37quymtVuaXjcOETJG+0qA2w+Gf++L+9UQjyIC3tc5MQUYic0U UvMA== X-Gm-Message-State: AJaThX42zgBQL5IEAtQap781q0mt/0rRH7EICysxfCYAyKl/Lj68lfqG wjrBE1xor2k2oksA8t+Hg7R8lRH3/BuogrIVff8= X-Received: by 10.55.19.206 with SMTP id 75mr2937090qkt.33.1511943614298; Wed, 29 Nov 2017 00:20:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.44.66 with HTTP; Wed, 29 Nov 2017 00:20:13 -0800 (PST) In-Reply-To: <1511917656.19952.52.camel@perches.com> References: <20171127235253.GA20384@embeddedor.com> <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@gator4166.hostgator.com> <20171128122235.Horde.vFP-9ZfAP0f9BFNePB8Z8xi@gator4166.hostgator.com> <20171128190032.2b1fa464@alans-desktop> <20171128143714.Horde.2uPOfQfKWjP7aGfH2w0lflN@gator4166.hostgator.com> <1511917656.19952.52.camel@perches.com> From: Geert Uytterhoeven Date: Wed, 29 Nov 2017 09:20:13 +0100 X-Google-Sender-Auth: p6ThJa6iQvnk1tGhcUc0pn5cqVg Message-ID: Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs To: Joe Perches Cc: "Gustavo A. R. Silva" , Linus Torvalds , Alan Cox , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , LKML , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joe, On Wed, Nov 29, 2017 at 2:07 AM, Joe Perches wrote: > On Tue, 2017-11-28 at 14:37 -0600, Gustavo A. R. Silva wrote: >> Quoting Linus Torvalds : >> > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox >> > wrote: >> > > The notation in question has been standard in tools like lint since the >> > > end of the 1970s >> > >> > Yes. >> > >> > That said, maybe one option would be to annotate the "case:" and >> > "default:" statements if that makes people happier. >> > >> > IOW, we could do something like >> > >> > #define fallthrough __atttibute__((fallthrough)) >> > >> > and then write >> > >> > fallthrough case 1: >> > ... >> > >> > which while absolutely not traditional, might look and read a bit more >> > logical to people. I mean, it literally _is_ a "fallthrough case", so >> > it makes semantic sense. >> > >> >> This is elegant. The thing is that this makes it appear as if there is >> an unconditional fall through. >> >> It is not uncommon to have multiple break statements in the same case >> block and to fall through also. > > My preferred syntax would be to use __fallthrough or fallthrough > in the same manner as break; > > switch (foo) { > case bar: > bar(); > fallthrough; > case baz: > baz(); > break; > default; > qux(); > exit(1); > } Makes sense to me. Comments are fragile. In addition, they are stripped if you run cpp (or gcc -E) separately, unlike __atttibute__((fallthrough)). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From 1585360624122457906@xxx Wed Nov 29 01:08:29 +0000 2017 X-GM-THRID: 1585265423856272058 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread