================
@@ -43,6 +43,11 @@ void call_snprintf(double d, int n, int *ptr) {
   __builtin_snprintf(node_name, sizeof(node_name), "%pOFn", ptr); // 
nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, 
but format string expands to at least 7}}
   __builtin_snprintf(node_name, sizeof(node_name), "12345%pOFn", ptr); // 
nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, 
but format string expands to at least 12}}
   __builtin_snprintf(node_name, sizeof(node_name), "123456%pOFn", ptr); // 
nonkprintf-warning {{'snprintf' will always be truncated; specified size is 6, 
but format string expands to at least 13}}
+  __builtin_snprintf(buf, 6, "%5.1f", 9.f);
+  __builtin_snprintf(buf, 6, "%+5.1f", 9.f);
----------------
vbvictor wrote:

When we have both space and `+` we get warning "flag ' ' is ignored when flag 
'+' is present [-Wformat]" https://godbolt.org/z/Weh146a5o. Should I still add 
tests for this? If I add tests, should I disable `Wformat` in RUN command or 
make it `// expected-warning`.

I added tests with multiple spaces after `%` - they are ignored.

https://github.com/llvm/llvm-project/pull/144274
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to