<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60764>60764</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy does not always warn of too many arguments in call function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          omarandlorraine
      </td>
    </tr>
</table>

<pre>
    Contents of "noarg.h":

```
#include <stdio.h>
int fn();
```

Contents of "noarg.c":
```
#include "noarg.h"

int fn() {
    return printf("hello");
}
```

Contents of "main.c":
```
#include "noarg.h"
int main() {
 fn(354);
}
```

Here we're calling `fn` with the wrong number of arguments. It's technically legal C (at least, before C23), but I feel that `clang-tidy` should warn us of the fact that declaring a function in this way: `int fn();` is bug-prone. 

It is worth noting that if clang-tidy sees the function definition *before* the call-site (not after), then we get a suitable warning. So, if we do this:

```
cat noarg.h noarg.c main.c > okay.c
clang-tidy okay.c
```

Then clang-tidy will warn us:

```
/home/sam/tmp/okay.c:10:11: warning: too many arguments in call to 'fn' [clang-diagnostic-warning]
    fn(354);
 ^
```

which is correct and helpful. But clang-tidy does not warn us if we reverse the order of call-site and function:

```
cat noarg.h main.c noarg.c > okay.c
clang-tidy okay.c
```

we don't get the warning.

Have I found a problem with clang-tidy here?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVd2OszYQfRrnZrTIa_6SCy52sxt1r9sXMGbAbo0d2cOivH1lIE22zfd1pU-KDIHxnDNzzhgZoxkcYsPKV1a-7eRE2ofGjzJI11kfgjQOd63vLs3RO0JHEXwPTAjnZRgyzYRg-Qvjb4xf14pvv_WvyI1TduoQWH6M1BmfaZa_r2-NI-gdE3smDix_fZxhWR_Cqy_wPwb-Qvcu6T08sHrDBwAISFNwcA7GUb8ECI3W-pTgnmr99n3OozTuFygnsinFf-guFeRl8X1iv2FAmJGJOiA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