Thread (44 messages) 44 messages, 11 authors, 2018-10-23

Re: [PATCH 2/2] Compiler Attributes: auxdisplay: panel: use __fallthrough

From: Miguel Ojeda <hidden>
Date: 2018-10-22 09:52:14
Also in: linux-ext4, linux-kbuild, lkml

On Sun, Oct 21, 2018 at 8:11 PM Joe Perches [off-list ref] wrote:
On Sun, 2018-10-21 at 19:14 +0200, Miguel Ojeda wrote:
quoted
Let gcc know these cases are meant to fall through to the next label
by annotating them with the new __fallthrough statement attribute;
and remove the comment since it conveys the same information
(which was also parsed by gcc to suppress the warning).
Instead of many individual conversion patches,
perhaps a script to do all the conversions at once.
Note that this was only an example of the attribute (some people asked
for an example when introducing another one, so I preemptively did it
for this one).

Doing the conversion (and how :-) I left it for afterwards, if people
agree with the attribute.
Maybe:

pattern='(?:\/\*\s*fall(?:\s*|\s*\-\s*)thr(?:u|ough)\s*\*\/|\/\/\s*fall\s*thr(?:u|ough)\s*$)'
git grep -P -i --name-only "$pattern" -- '*.[ch]' |
    xargs perl -p -i -e "s/$pattern/__fallthrough;/gi"

By the way, I checked first if coccinelle could match input comments,
but it doesn't, according to Julia. I am also thinking whether a
compiler plugin could easily do this, but I don't have my hopes high
given these are comments...

Also, regardless of how it is done, the patches need to be sent
individually to maintainers, no? I have a vague memory that big &
automated conversions were a bit frozen upon in the kernel. Greg...?

Cheers,
Miguel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help