lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 20 Oct 2018 16:42:07 +0200 From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com> To: Dan <dan.carpenter@...cle.com> Cc: Greg KH <gregkh@...uxfoundation.org>, kys@...rosoft.com, olaf@...fle.de, sthemmin@...rosoft.com, jasowang@...hat.com, linux-kernel <linux-kernel@...r.kernel.org>, Stable@...r.kernel.org, Michael.H.Kelley@...rosoft.com, Robo Bot <apw@...onical.com>, devel@...uxdriverproject.org, vkuznets@...hat.com, haiyangz@...rosoft.com Subject: Re: [PATCH 3/5] Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up +On Wed, Oct 17, 2018 at 8:25 AM Dan Carpenter <dan.carpenter@...cle.com> wrote: > > It's not common at all. It should be wrapped in a macro and put into > compiler.h. > > But I hope it does become adopted. It's better than randomly grepping > for non-standard comments. Using an attribute is indeed better whenever possible. In C++17 it is an standard attribute and there have been proposals to include some of them for C as well since 2016 at least, e.g. the latest for fallthrough at: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2268.pdf I have taken a quick look into supporting it (typing it here to save it on the mailing list :-), and we have: * gcc >= 7.1 supports -Wimplicit-fallthrough with __attribute__((fallthrough)), the comment syntax and the C++ [[fallthrough]] syntax. * gcc < 7.1 complains about empty declarations (it does not know about attributes for null statements) and also -Wdeclaration-after-statement. * clang 7 supports -Wimplicit-fallthrough (not enabled in -Wall/extra/pedantic like gcc, though) but *only* in C++ mode and with the C++ syntax [[fallthrough]]. In other words, in C mode, no syntax works and no diagnostics are emitted. It complains about Wmissing-declarations. [IMO they should allow the __attribute__ syntax for fallthrough (and enable it on C mode) to be compatible with gcc. Maybe they are simply waiting for the C2x attributes... :-)] * icc 19 does not know about -Wimplicit-fallthrough at all (but seems to allow [[fallthrough]] on C++17 mode to comply with the standard). Therefore, the only improvement we could do right now is starting to use the attribute for gcc > 7.1, and a comment for everybody else. However, even if that was worth the trouble of changing the 2500+ instances of fall through markings that we have, comments are replaced before the preprocessor stage, so we would need some (probably non-portable) macro magic. So, I would say, let's revisit this again in a few years. Possibly, when we move the minimum version to gcc 7.1, clang and icc may both support the fallthrough warning in C mode; so that we can always use the __attribute__((fallthrough)) unconditionally under a __fallthrough #define. Cheers, Miguel
Powered by blists - more mailing lists