On Fri, Oct 2, 2020 at 9:21 PM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > I do care about the tree as a whole, and I'm particularly interested in > having -Wmissing-declarations/-Wmissing-prototypes enabled globally > at some point in the future. > > Arnd BTW, if possible, please educate me about the difference between -Wmissing-declarations and -Wmissing-prototypes. The GCC manual says as follows: -Wmissing-prototypes (C and Objective-C only) Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. Use this option to detect global functions that do not have a matching prototype declaration in a header file. This option is not valid for C++ because all function declarations provide prototypes and a non-matching declaration declares an overload rather than conflict with an earlier declaration. Use -Wmissing-declarations to detect missing declarations in C++. -Wmissing-declarations Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. In C, no warnings are issued for functions with previous non-prototype declarations; use -Wmissing-prototypes to detect missing prototypes. In C++, no warnings are issued for function templates, or for inline functions, or for functions in anonymous namespaces. The difference is still unclear to me... For example, if I add -Wmissing-declarations, I get the following: kernel/sched/core.c:2380:6: warning: no previous declaration for ‘sched_set_stop_task’ [-Wmissing-declarations] 2380 | void sched_set_stop_task(int cpu, struct task_struct *stop) | ^~~~~~~~~~~~~~~~~~~ But, if I add both -Wmissing-declarations and -Wmissing-prototypes, -Wmissing-declarations is superseded by -Wmissing-prototypes. kernel/sched/core.c:2380:6: warning: no previous prototype for ‘sched_set_stop_task’ [-Wmissing-prototypes] 2380 | void sched_set_stop_task(int cpu, struct task_struct *stop) | ^~~~~~~~~~~~~~~~~~~ Do we need to specify both in W=1 ? If yes, what is the difference between them? -- Best Regards Masahiro Yamada