Thread (42 messages) 42 messages, 13 authors, 2025-03-13

Re: [PATCH *-next 01/18] mm/mmu_gather: Remove needless return in void API tlb_remove_page()

From: Zijun Hu <hidden>
Date: 2025-02-26 11:30:37
Also in: linux-arch, linux-crypto, linux-gpio, linux-iommu, linux-mm, linux-pm, linux-rdma, linux-wireless, lkml

On 2025/2/26 01:27, Przemek Kitszel wrote:
quoted
quoted
quoted
quoted
It might not be your preferred coding style, but it is not completely
pointless.
based on below C spec such as C17 description. i guess language C does
not like this usage "return void function in void function";
This is GNU extension IIRC. Note kernel uses GNU11, not C11
any link to share about GNU11's description for this aspect ? (^^)
this is new for C17 or was there for long time?
Standard C spec has that description for long time.
Standard C11 spec also has that description.
even if this is an extension, it is very nice for generating locked
wrappers, so you don't have to handle void case specially

void foo_bar(...)
{
    lockdep_assert_held(&a_lock);
    /// ...
}

// generated
void foo_bar_lock(...)
{
    scoped_guard(mutex, &a_lock)
        return foo_bar(...);
above is able to be written as below:
      scoped_guard(mutex, &a_lock) {
	foo_bar(...);
	return;
      }
}
i will list my reasons why this usage "return void function in void
function" is not good in cover letter [00/18] of this series.

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