-Wformat does not trigger with wrong `printf` formats
See original GitHub issue-Wformat does not trigger with very obviously wrong printf
formats. Like printf("", 1);
Logs
V[16:56:52.813] <<< {"id":865,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///d%3A/Desktop/C/College/Vending%20Machine/411410040.c"}}}
I[16:56:52.813] <-- textDocument/semanticTokens/full(865)
V[16:56:52.813] ASTWorker running SemanticHighlights on version 1 of d:\Desktop\C\College\Vending Machine\411410040.c
V[16:56:52.813] <<< {"id":866,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///d%3A/Desktop/C/College/Simple%20Base%20Conversion/SimpleBaseConversion.c"}}}
I[16:56:52.813] <-- textDocument/semanticTokens/full(866)
V[16:56:52.813] ASTWorker running SemanticHighlights on version 420 of d:\Desktop\C\College\Simple Base Conversion\SimpleBaseConversion.c
I[16:56:52.813] --> reply:textDocument/semanticTokens/full(866) 0 ms
V[16:56:52.813] >>> {"id":866,"jsonrpc":"2.0","result":{"data":[2,4,4,3,8193,2,9,5,1,1025,1,11,5,3,8192,0,6,5,1,1024,0,11,5,19,8192,0,10,4,19,8192,2,12,5,1,1024,4,21,3,1,1025,1,12,5,1,1024,0,19,5,1,1024,2,12,6,3,4096,0,7,5,1,1024,0,18,3,1,1024,1,12,6,3,4096,0,15,3,1,1024,4,12,6,3,4096,0,7,5,1,1024,0,14,3,1,1024,1,12,6,3,4096,0,17,3,1,1024],"resultId":"184"}}
I[16:56:52.813] --> textDocument/clangd.fileStatus
V[16:56:52.813] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///d:/Desktop/C/College/Simple%20Base%20Conversion/SimpleBaseConversion.c"}}
I[16:56:52.814] --> reply:textDocument/semanticTokens/full(865) 0 ms
V[16:56:52.814] >>> {"id":865,"jsonrpc":"2.0","result":{"data":[9,15,6,8,8193,0,7,6,8,4097,6,0,6,8,4096,0,8,10,3,8193,0,11,6,18,4096,0,7,11,2,1025,0,13,6,18,4096,0,7,8,2,1025,4,5,13,3,8193,0,20,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,18,3,8193,0,25,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,21,3,8193,0,28,6,8,4096,0,8,6,2,1033,6,0,4,19,8192,0,5,15,3,8193,0,16,6,8,4096,0,8,6,2,1025,0,20,5,2,1033,5,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,7,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,0,17,5,2,1033,6,0,4,19,8192,0,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,6,6,9,3,8193,0,16,6,8,4096,0,8,6,2,1033,0,8,6,18,4096,0,7,3,2,1025,5,6,15,3,8193,0,22,6,8,4096,0,8,6,2,1033,5,6,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,5,0,6,8,4096,0,8,11,3,8193,0,18,6,8,4096,0,8,4,2,1033,6,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,3,2,1033,0,11,6,8,4096,0,8,3,2,1033,4,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,5,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,6,2,1033,5,0,4,19,8192,0,5,18,3,8193,0,19,6,8,4096,0,8,6,2,1025,7,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,4,2,1025,6,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,8,2,1025,4,0,6,8,4096,0,8,7,3,8193,6,5,13,3,8193,0,20,6,8,4096,0,8,3,2,1033,0,5,6,18,4096,0,7,3,2,1025,12,0,6,8,4096,0,8,8,3,8193,0,15,6,8,4096,0,8,3,2,1033,2,4,4,3,8193,5,7,6,8,8193,2,4,6,18,4096,0,7,4,6,2049,1,4,6,18,4096,0,7,8,6,2049,1,4,6,18,4096,0,7,11,6,2049,1,10,4,6,2049,3,0,6,8,4096,0,8,10,3,8193,0,11,6,18,4096,0,7,11,2,1025,0,13,6,18,4096,0,7,8,2,1025,2,8,11,2,1024,2,15,4,19,8192,2,4,6,8,4096,0,8,9,1,1025,0,12,6,3,8192,0,14,6,8,4096,1,9,9,1,1024,2,15,4,19,8192,2,4,9,1,1024,0,11,4,6,2048,1,4,9,1,1024,0,11,8,6,2048,0,11,8,2,1024,1,4,9,1,1024,0,11,11,6,2048,0,14,11,2,1024,1,8,8,2,1024,2,8,9,1,1024,0,11,4,6,2048,0,7,6,3,8192,0,7,8,2,1024,0,10,11,2,1024,1,13,9,1,1024,0,11,4,6,2048,2,12,4,3,8192,0,5,9,1,1024,1,19,4,19,8192,5,8,9,1,1024,0,11,4,6,2048,0,7,4,19,8192,2,11,9,1,1024,3,5,13,3,8193,0,20,6,8,4096,0,8,6,2,1033,2,4,4,3,8192,0,5,6,2,1032,0,8,4,6,2048,1,4,4,3,8192,0,14,9,18,4096,0,10,6,2,1032,3,0,6,18,4096,0,7,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,4,6,2048,3,0,6,18,4096,0,7,18,3,8193,0,25,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,8,6,2048,3,0,6,18,4096,0,7,21,3,8193,0,28,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,11,6,2048,3,0,4,19,8192,0,5,15,3,8193,0,16,6,8,4096,0,8,6,2,1025,0,20,5,2,1033,2,9,13,3,8192,0,14,6,2,1024,0,8,6,2,1024,0,8,4,6,2048,0,6,5,2,1032,2,15,5,19,8192,2,11,4,19,8192,3,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,2,9,12,3,8192,0,13,6,2,1024,0,8,6,2,1024,0,8,4,6,2048,2,15,5,19,8192,2,11,4,19,8192,3,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,0,17,5,2,1033,2,8,3,2,1024,0,6,6,2,1024,0,8,4,6,2048,0,9,5,2,1032,2,15,5,19,8192,2,8,6,2,1024,0,8,4,6,2048,0,8,6,2,1024,0,8,8,6,2048,2,8,6,18,4096,0,7,14,1,1025,1,12,6,2,1024,0,8,8,6,2048,2,12,14,1,1024,0,17,6,2,1024,0,8,8,6,2048,2,13,14,3,8192,0,15,6,2,1024,0,8,14,1,1024,2,19,5,19,8192,3,4,7,3,8192,0,16,6,2,1024,0,8,4,6,2048,0,8,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,0,21,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,14,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,7,6,2,1024,0,8,11,6,2048,1,4,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,13,5,2,1032,0,7,6,2,1024,0,8,11,6,2048,1,4,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,0,4,19,8192,0,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,2,8,3,2,1024,0,7,6,2,1024,0,8,4,6,2048,2,15,5,19,8192,2,4,7,3,8192,0,16,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,21,6,2,1024,0,8,4,6,2048,0,8,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,0,14,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,1,4,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,6,9,3,8193,0,16,6,8,4096,0,8,6,2,1033,0,8,6,18,4096,0,7,3,2,1025,2,8,3,2,1024,0,7,6,2,1032,0,8,4,6,2048,0,9,6,2,1032,0,8,4,6,2048,0,8,6,2,1032,0,8,4,6,2048,2,15,4,19,8192,2,19,6,2,1032,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1032,0,8,11,6,2048,3,6,15,3,8193,0,22,6,8,4096,0,8,6,2,1033,2,11,9,3,8192,0,10,6,2,1032,0,8,6,2,1032,0,8,4,6,2048,3,6,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,2,11,9,3,8192,0,10,6,2,1032,3,0,6,8,4096,0,8,11,3,8193,0,18,6,8,4096,0,8,4,2,1033,2,4,6,8,4096,0,8,4,1,1025,0,7,10,3,8192,0,11,4,2,1032,0,6,11,6,2048,1,9,4,1,1024,2,15,4,19,8192,2,4,4,1,1024,0,6,4,6,2048,0,7,4,2,1032,0,6,4,6,2048,1,4,4,1,1024,0,6,8,6,2048,0,11,4,2,1032,0,6,8,6,2048,1,8,4,1,1024,0,6,8,6,2048,2,8,4,1,1024,0,6,4,6,2048,0,7,4,19,8192,1,15,4,1,1024,2,10,10,1,1025,0,13,6,3,8192,0,7,4,2,1032,0,6,8,6,2048,0,11,4,2,1032,0,6,11,6,2048,1,9,10,1,1024,2,8,13,3,8192,0,14,4,1,1024,1,15,4,19,8192,2,4,6,3,8192,0,7,10,1,1024,0,12,4,2,1032,0,6,4,6,2048,0,6,4,2,1032,0,6,8,6,2048,0,11,4,2,1032,0,6,11,6,2048,1,4,4,1,1024,0,6,4,6,2048,0,7,10,1,1024,1,11,4,1,1024,3,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,3,2,1033,0,11,6,8,4096,0,8,3,2,1033,2,9,3,2,1032,0,8,3,2,1032,0,7,3,2,1032,0,5,4,6,2048,0,8,3,2,1032,0,5,4,6,2048,0,8,3,2,1032,0,5,11,6,2048,0,15,3,2,1032,0,5,11,6,2048,2,15,5,19,8192,2,8,6,3,8192,0,7,3,2,1032,0,5,4,6,2048,0,6,3,2,1032,0,5,4,6,2048,0,6,3,2,1032,0,5,4,6,2048,0,7,3,2,1032,0,5,11,6,2048,2,15,4,19,8192,4,15,5,19,8192,4,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,2,4,6,2,1024,0,8,4,6,2048,3,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,4,6,2048,3,0,4,19,8192,0,5,18,3,8193,0,19,6,8,4096,0,8,6,2,1025,2,8,6,2,1024,0,8,4,6,2048,2,8,4,3,8192,0,5,6,2,1024,0,8,4,6,2048,1,8,6,2,1024,0,8,4,6,2048,0,7,4,19,8192,1,15,4,19,8192,2,10,7,1,1025,0,10,7,3,8192,0,8,6,2,1024,0,8,4,6,2048,0,6,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,11,6,2048,1,9,7,1,1024,2,15,5,19,8192,2,4,6,2,1024,0,8,4,6,2048,0,7,7,1,1024,1,4,6,2,1024,0,8,8,6,2048,0,11,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,4,2,1025,2,8,4,2,1024,0,7,6,2,1024,0,8,4,6,2048,2,12,4,2,1024,0,8,6,2,1024,0,8,8,6,2048,2,12,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,11,6,2048,0,17,4,2,1024,0,7,6,2,1024,0,8,4,6,2048,0,8,6,2,1024,0,8,11,6,2048,1,12,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,19,4,19,8192,4,12,6,18,4096,0,7,11,1,1025,1,19,11,1,1024,0,14,4,2,1024,2,16,11,1,1024,2,17,14,3,8192,0,15,6,2,1024,0,8,11,1,1024,2,23,5,19,8192,2,12,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,19,4,19,8192,5,8,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,15,4,19,8192,4,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,8,2,1025,2,8,8,2,1024,0,12,6,2,1024,0,8,8,6,2048,2,15,4,19,8192,4,14,7,1,1025,0,10,7,3,8192,0,8,6,2,1024,0,8,4,6,2048,0,6,8,2,1024,0,11,6,2,1024,0,8,11,6,2048,1,13,7,1,1024,2,19,5,19,8192,2,8,6,2,1024,0,8,4,6,2048,0,7,7,1,1024,1,8,6,18,4096,0,7,11,1,1025,0,14,6,2,1024,0,8,8,6,2048,1,8,6,2,1024,0,8,8,6,2048,0,11,8,2,1024,1,8,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,11,1,1024,0,14,6,2,1024,0,8,11,6,2048,0,17,6,2,1024,0,8,8,6,2048,0,11,11,1,1024,0,15,6,2,1024,0,8,11,6,2048,1,15,4,19,8192,4,0,6,8,4096,0,8,7,3,8193,2,4,6,8,4096,0,8,6,1,1025,0,9,10,3,8192,1,8,1,1,1025,1,12,1,1,1024,0,4,7,3,8192,0,14,3,19,8192,0,7,1,1,1024,2,13,5,1,1025,0,14,1,1,1024,1,8,15,3,8192,0,16,6,1,1024,0,9,5,1,1024,2,11,6,1,1024,3,5,13,3,8193,0,20,6,8,4096,0,8,3,2,1033,0,5,6,18,4096,0,7,3,2,1025,2,20,9,3,8192,0,10,3,2,1032,0,5,3,2,1024,3,0,6,8,4096,0,8,8,3,8193,0,15,6,8,4096,0,8,3,2,1033,2,4,6,8,4096,0,8,6,1,1025,0,9,10,3,8192,0,18,6,8,4096,1,4,6,18,4096,0,7,9,1,1025,0,12,14,3,8192,0,15,3,2,1032,1,9,6,18,4096,0,7,1,1,1025,0,7,1,1,1024,0,4,9,1,1024,0,11,1,1,1024,2,12,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,6,16,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,20,1,1,1024,0,5,9,1,1024,4,16,6,18,4096,0,7,13,1,1025,0,16,9,1,1024,1,21,6,18,4096,0,7,1,1,1025,0,4,1,1,1024,0,7,1,1,1024,0,4,9,1,1024,0,11,1,1,1024,2,24,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,24,13,1,1024,0,16,1,1,1024,4,16,6,18,4096,0,7,10,1,1025,0,13,1,1,1024,0,7,8,1,1025,0,11,13,1,1024,1,16,4,19,8192,0,5,12,1,1025,0,15,5,19,8192,1,24,10,1,1024,0,13,13,1,1024,0,15,10,1,1024,2,25,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,10,1,1024,4,24,10,1,1024,0,14,13,1,1024,2,24,12,1,1024,0,15,4,19,8192,4,20,12,1,1024,2,20,1,1,1024,0,4,13,1,1024,3,23,8,1,1024,0,11,1,1,1024,0,3,8,1,1024,2,25,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,8,1,1024,5,16,6,8,4096,0,8,5,1,1025,0,8,10,3,8192,0,25,10,1,1024,0,13,8,1,1024,1,21,6,18,4096,0,7,1,1,1025,0,4,10,1,1024,0,12,1,1,1024,0,5,8,1,1024,0,10,1,1,1024,2,20,15,3,8192,0,16,5,1,1024,0,15,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,16,15,3,8192,0,16,6,1,1024,0,8,5,1,1024,4,11,6,1,1024],"resultId":"100"}}
I[16:56:52.814] --> textDocument/clangd.fileStatus
V[16:56:52.814] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///d:/Desktop/C/College/Vending%20Machine/411410040.c"}}
System information
Clangd version (from the log, or clangd --version
): 15.0.3
clangd extension version: 0.1.23
Operating system: Windows 10
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Incorrect printf format specifier compiles - c++ - Stack Overflow
It is not compiling format specifiers (just passing literal constants as ... BTW, the control format string for size_t in printf is %zu....
Read more >C51: PRINTF Gives Wrong Values - Arm Developer
Probably the most common reason is that the format specifier and the argument type do not match. To solve this kind of problem,...
Read more >Formatted Output and the printf function
A format specifier is a placeholder that performs two functions. First, it shows where in the output to place an item not otherwise...
Read more >Printf() - an overview | ScienceDirect Topics
The printf() function sends a formatted string to the standard output (the display). This string can display formatted variables and special control ...
Read more >Bash printf formating not working - Unix & Linux Stack Exchange
@steeldriver The behavior he is expecting is not POSIX compliant. He may be on linux where a non-compliant /usr/bin/printf with a related non- ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, that’s understandable. In clangd 16 you can use
--query-driver
withoutcompile_commands.json
, by setting the path of the compiler to be queried using theCompiler:
key (underCompileFlags:
) in the clangd config file. You can get a pre-release version of clangd 16 from the releases page (e.g. https://github.com/clangd/clangd/releases/tag/snapshot_20221127 is the current latest weekly snapshot), so that’s an option to try.Alternatively, if you use something like
make
to build your single file, you can generate acompile_commands.json
using a tool such as https://github.com/nickdiego/compiledb.One way or another, I would suggest trying
--query-driver
as the way to get clangd to use the TDM-GCC header paths, rather than specifying them manually.i’m using vscode-clangd in remote linux, same issue as you posted. Moreover, Errors in the following came up periodically.
Clangd version (from the log, or clangd --version): 16.0.0 clangd extension version: 0.1.23 Operating system: centos 2.6