@Aaron: Yes, I'm aware of that. I wanted to show that my check does not
take this into account.
In C++ this code is equivalent, so I think nothing should be reported,
unless we really want to get rid of that void, but I suppose this other
check does it already.
And when it comes to C, in well-formed C code, we should never see those
two definitions of allright() and allright(void), as they are
declarations of different functions. If I try to add empty bodies {} to
define them, this example won't even compile.
So anyway, I still don't understand the problem here, unless somebody
explains it in clearer terms.
Best regards,
Piotr Dziwinski
On 2015-08-30 22:43, Aaron Ballman wrote:
On Sun, Aug 30, 2015 at 4:39 PM, Piotr Dziwinski via cfe-commits
<cfe-commits@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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits