<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68995>68995</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
some warnings not shown using mingw headers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
snylonue
</td>
</tr>
</table>
<pre>
```C
#include <stdio.h>
int main() {
int i;
scanf("%f", &i);
printf("%d", i, i ,2);
return 0;
}
```
```
clang -Wall .\warn.c
.\warn.c:5:5: warning: 'scanf' is deprecated: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
scanf("%f", &i);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\stdio.h:1275:20: note: 'scanf' has been explicitly marked deprecated here
_Check_return_ _CRT_INSECURE_DEPRECATE(scanf_s)
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:355:55: note: expanded from macro
'_CRT_INSECURE_DEPRECATE'
#define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT( \
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime.h:345:47: note: expanded from macro
'_CRT_DEPRECATE_TEXT'
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
^
.\warn.c:5:17: warning: format specifies type 'float *' but the argument has type 'int *' [-Wformat]
scanf("%f", &i);
~~ ^~
%d
.\warn.c:6:21: warning: data argument not used by format string [-Wformat-extra-args]
printf("%d", i, i ,2);
~~~~ ^
3 warnings generated.
```
```
clang -Wall --target=x86_64-w64-mingw32 .\warn.c
```
FYI, gcc generates warnings with the same header.
```
gcc -Wall .\warn.c
.\warn.c: In function 'main':
.\warn.c:5:13: warning: format '%f' expects argument of type 'float *', but argument 2 has type 'int *' [-Wformat=]
5 | scanf("%f", &i);
| ~^ ~~
| | |
| | int *
| float *
| %d
.\warn.c:6:12: warning: too many arguments for format [-Wformat-extra-args]
6 | printf("%d", i, i ,2);
|
```
My environment:
```
clang --version
clang version 16.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\snylo\scoop\apps\llvm\current\bin
```
```
gcc --version
gcc.exe (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Both are installed through `scoop` (llvm and mingw-winlibs package)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMV0uT4jgS_jXikoHDlrENBw6UC2aJna6uAHpq50QIO21rx5YcklwUl_7tG5LNox5d09OnJaowUqZE5pdfPmBa81Igzkl0R6L7EetMJdVci1MtRYejg8xPcxL7_V9K_HviLwgNucjqLkcgYapNzqVXkXA5SN07FwYaxgWhU0JnQJK7fh8AwMo4CW92dMZE4VQpoVHhHikQGnNCZ680W8WFuarmgyp3b0BoSm9PXM8pNJ0S4F9Fyf3w4ezd7ZE3m1nNRAnjJ1bX4JEoPTIlvKyX3azDRTT8g93horQfCU0G_xLgGnJsFWbMYG6Fu4prKDqRGS4FSAXPTHF2qBEadoIDQic0K9CDVArNc1TQaS7KHrG9Bi60QZZ7sJOQc-1Onr-BS2Fh6TSCe-3TzW6_XabfNsv9w9f902LzsH74bevBFhGkqLlAqLBuoZAKcjSM19oDEt2Nn65Gj3PMaqbc7ZpE978SRBINXElJuCBR-qhkqVgDK16jBkKnL9PYnonSJy5yedTwb240idLAJ1G67rnnlp7vURrTwLOCLlOGRFdCLgKa2GBQ3yItpMG34aiYhgOiAHxpa55xU5-gYeovzG_CBBUqHIzfpxVmf-17Nu17RNcPA6b3y8fNMl3sloROh_hYL_qTn_p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