Re: [PATCH] afs: fix no return statement in function returning non-void

From: Randy Dunlap
Date: Thu May 27 2021 - 15:49:01 EST


On 4/19/21 3:31 PM, Randy Dunlap wrote:
> On 4/8/21 7:06 AM, David Howells wrote:
>> Zheng Zengkai <zhengzengkai@xxxxxxxxxx> wrote:
>>
>>> static int afs_dir_set_page_dirty(struct page *page)
>>> {
>>> BUG(); /* This should never happen. */
>>> + return 0;
>>> }
>>
>> That shouldn't be necessary. BUG() should be marked as 'no return' to the
>> compiler. What arch and compiler are you using?
>
> How do mark a #define BUG() as __noreturn?
>
> Several arch-es use #define for BUG() instead of using a function.

Hi David,

So you are counting of BUG() being a function and not a macro?

Doesn't seem like a good idea.

--
~Randy