RE: [PATCH] string.h: Mark 34 functions with __must_check

From: David Laight
Date: Thu Oct 10 2019 - 11:46:22 EST


From: David Sterba
> Sent: 10 October 2019 15:28
...
> > Can we pick a style and enforce it via checkpatch? (It's probably not
> > fun to check for each function attribute in
> > include/linux/compiler_attributes.h).
>
> Anything that has the return type, attributes and function name on one
> line works for me, but I know that there are other style preferences
> that put function name as the first word on a separate line.

Having the function name first makes it much easier to find the function itself.
In the linux kernel tree searching for 'EXPORT.*function_name' works most f the time.

> My reasons are for better search results, ie.
>
> extent_map.c:void __cold extent_map_exit(void)
> extent_map.h:void __cold extent_map_exit(void);
> file.c:void __cold btrfs_auto_defrag_exit(void)
> inode.c:void __cold btrfs_destroy_cachep(void)
> ordered-data.c:void __cold ordered_data_exit(void)
> ordered-data.h:void __cold ordered_data_exit(void);
>
> is better than
>
> send.c:__cold
> super.c:__cold
> super.c:__cold
> super.c:__cold
>
> which I might get to fix eventually.

That is what -A1 in for :-)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)