<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56526>56526</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
No version of clang suggests a typo on implicit declaration of a function nor does it show in which function the implicit declaration of a functions happens like gcc since 7.1
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gstjepan2
</td>
</tr>
</table>
<pre>
# Examples
#### Examples from standard library
##### Sample code
```c
#include <stdio.h>
int main(){
putd("Hello, World");
}
```
x86-64 clang 14.0.0 outputs:
```
<source>:3:3: warning: implicit declaration of function 'putd' is invalid in C99 [-Wimplicit-function-declaration]
putd("Hello, World");
^
1 warning generated.
Compiler returned: 0
```
x86-64 gcc :
```
<source>: In function 'main':
<source>:3:3: warning: implicit declaration of function 'putd'; did you mean 'puts'? [-Wimplicit-function-declaration]
putd("Hello, World");
^~~~
puts
Compiler returned: 0
```
##### Sample code
```c
#include <stdio.h>
int main(){
printd("Hello, World");
}
```
x86-64 clang 14.0.0 outputs:
```
<source>:3:3: warning: implicit declaration of function 'printd' is invalid in C99 [-Wimplicit-function-declaration]
printd("Hello, World");
^
1 warning generated.
Compiler returned: 0
```
x86-64 gcc any version since 7.1 including 7.1 outputs:
```
<source>:3:3: warning: implicit declaration of function 'printd' is invalid in C99 [-Wimplicit-function-declaration]
printd("Hello, World");
^
1 warning generated.
Compiler returned: 0
```
#### Examples from user defined functions
##### Sample code
```
#include <stdio.h>
void sample_function1(){
}
void sample_function2(){
sample_dunction1();
}
int main(){
printd("Hello, World");
sample_functiony();
}
```
x86-64 clang 14.0.0 outputs:
```
<source>:5:5: warning: implicit declaration of function 'sample_dunction1' is invalid in C99 [-Wimplicit-function-declaration]
sample_dunction1();
^
<source>:9:3: warning: implicit declaration of function 'printd' is invalid in C99 [-Wimplicit-function-declaration]
printd("Hello, World");
^
<source>:10:3: warning: implicit declaration of function 'sample_functiony' is invalid in C99 [-Wimplicit-function-declaration]
sample_functiony();
^
3 warnings generated.
Compiler returned: 0
```
x86-64 gcc any version since 7.1 including 7.1 outputs:
```
<source>: In function 'sample_function2':
<source>:5:5: warning: implicit declaration of function 'sample_dunction1'; did you mean 'sample_function1'? [-Wimplicit-function-declaration]
sample_dunction1();
^~~~~~~~~~~~~~~~
sample_function1
<source>: In function 'main':
<source>:9:3: warning: implicit declaration of function 'printd'; did you mean 'printf'? [-Wimplicit-function-declaration]
printd("Hello, World");
^~~~~~
printf
<source>:10:3: warning: implicit declaration of function 'sample_functiony'; did you mean 'sample_function2'? [-Wimplicit-function-declaration]
sample_functiony();
^~~~~~~~~~~~~~~~
sample_function2
Compiler returned: 0
```
### Rationale
Rationale behind this issue is improving clang warning/error messages clarity.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztV8GOozgQ_RpyKQURE0I4cOjpntbuZQ-7hzmuDK6AZx0b2SY9-fs1EEg6pNUk6d7VSCM5IVD2c9VzvaKSKbZPPRLC1x90Wwk0XvDkBQ-vvkk4jGEabLTagrFUMqoZCJ5pqvfjBc2av9olkCuGhwmroBv5sIDLXNQMwQsfjWVc-aUXfu2sXFrYUi49svZI4sVfuscAVW1Z-5D8hkIojzzCN6WFe0aaieFhohc_nW3b3f5Yr-arJeSCygIWSz_wA1C1dajGCx_g4prGPVXrHBvvwofw8IEXqiWXRfOTu2B5zi0wdNCaWq4kqA1sapm3vz0Sd57HwA1wuaOCM3eFxyQBL_oy_9ZDzPs18xMsL3q6kgBwqAcuF72nUKBEB4jM7yyPaltxgRo02lpLZE0swWUSTukr8twd2sMUtuB3-YqF7lDj4-oPJdeFD8wRu1c1bJH2JtOanq8jejrTLdVxP06Wmxtp_s_EpJ3pHjn9_6I6RHC_rKZS8enConIPO9SmidC4U0WI_QV0x9vs1dwd2f1F7nVyOnuZ1cbhMNxwBzPEbq5V4RQR7pQjz7QQf_cbLc4UOcjs0mQyki_0U9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