[PATCH] D15636: Reduce false positives in printf/scanf format checker
Andy Gibbs via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 26 00:06:39 PST 2016
AndyG added a comment.
Thank you for looking at my patch. I would argue that the code
printf(minimal ? "%i\n" : "%i: %s\n", code, msg);
is valid and should //not// cause a warning due to unused arguments since at least one code path uses all the arguments. This in my view is the problem with the diagnostic as it currently stands.
I should expect that the following would cause the warning:
printf(minimal ? "%i\n" : "%i: %s\n", code, msg, unused);
which indeed it still does under this patch for the argument 'unused'. Also, where the compiler can determine that a code path is ever followed then it will still produce the warning, as in:
printf(1 ? "%i\n" : "%i: %s\n", code, msg);
More information about the cfe-commits