On Wed, Oct 09, 2019 at 10:33:45AM -0700, Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 9:38 AM Joe Perches <joe@xxxxxxxxxxx> wrote: > > > > On Wed, 2019-10-09 at 09:13 -0700, Nick Desaulniers wrote: > > > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > > > On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfring <Markus.Elfring@xxxxxx> wrote: > > [] > > > > > Several functions return values with which useful data processing > > > > > should be performed. These values must not be ignored then. > > > > > Thus use the annotation “__must_check” in the shown function declarations. > > [] > > > > I'm curious. How many warnings showed up when you applied this patch? > > > > > > I got zero for x86_64 and arm64 defconfig builds of linux-next with > > > this applied. Hopefully that's not an argument against the more > > > liberal application of it? I view __must_check as a good thing, and > > > encourage its application, unless someone can show that a certain > > > function would be useful to call without it. > > > > stylistic trivia, neither agreeing nor disagreeing with the patch > > as I generally avoid reading Markus' patches. > > > > I believe __must_check is best placed before the return type as > > that makes grep for function return type easier to parse. > > > > i.e. prefer > > [static inline] __must_check <type> <function>(<args...>); > > over > > [static inline] <type> __must_check <function>(<args...>); > > > > + Miguel > So I just checked `__cold`, and `__cold` is all over the board in > style. I see it: > 1. before anything fs/btrfs/super.c#L101 > 2. after static before return type (what you recommend) fs/btrfs/super.c#L2318 > 3. after return type fs/btrfs/inode.c#L9426 As you can see in the git history, case 1 is from 2015 and the newer changes put the attribute between type and name - that's my "current" but hopefully final preference. > 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. 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.