[PATCH] D12473: [clang-tidy] Add old style function check

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 30 13:43:14 PDT 2015


On Sun, Aug 30, 2015 at 4:39 PM, Piotr Dziwinski via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> piotrdz added a comment.
>
> @Eugene: I don't understand, what does declaring function with "void" argument have in common with this review? I only check here variable declarations inside functions.
>
> Maybe you meant my other review for inconsistent declaration parameter names? If so, this is how it behaves currently:
>
>   $ cat test.c
>   void allright();
>   void allright(void);
>
>   void notallright(int a);
>   void notallright(int b);
>
>   $ clang-tidy -checks='-*,readability-inconsistent-declaration-parameter-name' test.c -- -std=c11
>   1 warning generated.
>   /work/clang-trunk/test.c:4:6: warning: function 'notallright' has other declaration with different parameter name(s) [readability-inconsistent-declaration-parameter-name]
>   void notallright(int a);
>        ^
>   /work/clang-trunk/test.c:5:6: note: other declaration seen here
>   void notallright(int b);
>
> So I see no reason to add specific checks for functions with "void" parameter, unless you see something wrong with this behavior?

In C, void allright(); is a function accepting a variable number of
arguments, and void alright(void); is a function accepting no
arguments. In C++, they are both functions accepting no arguments.

~Aaron


More information about the cfe-commits mailing list