<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Does this patch look okay for me to go ahead and commit?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Seth</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 27, 2015, at 8:30 PM, Seth Cantrell <<a href="mailto:seth.cantrell@gmail.com" class="">seth.cantrell@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 26, 2015, at 8:28 PM, Seth Cantrell <<a href="mailto:seth.cantrell@gmail.com" class="">seth.cantrell@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 26, 2015, at 7:24 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 26, 2015 at 4:01 PM, Seth Cantrell <span dir="ltr" class=""><<a href="mailto:seth.cantrell@gmail.com" target="_blank" class="">seth.cantrell@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This enables a warning corresponding to gcc's warning of using %p modifiers with non-void* pointers, and to the printf/scanf specs which require void*.<br class="">
<br class="">
The warning is on by default for -Weverything users, off by default for others. It can be enabled with -pedantic or -Wformat-pedantic. It's not enabled by -Wformat.<br class=""></blockquote><div class=""><br class=""></div><div class="">From a high level, this seems like a good approach to the problem, thanks.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The patch includes tests and the clang-test target passes with this patch applied to a recent clang revision.<br class="">
<br class="">
I used clang-format to format my changes and the patch includes cleanup of a few trailing whitespace issues that were near my changes.<br class="">
<br class="">
See also the email thread at: <a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-February/041714.html" target="_blank" class="">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-February/041714.html</a></blockquote><div class=""><br class=""></div><div class="">It doesn't seem ideal to call matchesType twice to find out which diagnostic to issue; have you considered returning an enum { Match, NoMatchPedantic, NoMatch }; or similar instead?</div></div></div></div>
</div></blockquote></div><br class=""><div class="">That did initially occur to me but I saw the matchesType usages in a few other locations and wanted to keep a compatible API. It wasn't clear, for example, whether the NoMatchPedantic option should convert to true or false of if I should even support the current usage rather than make every use check for each condition explicitly.</div><div class=""><br class=""></div><div class="">I will go back and more carefully review the other usages to see what refactoring I need to do.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Seth</div></div></div></blockquote></div><div class=""><br class=""></div><div class="">Here's an updated patch which takes the suggested approach. I did keep the API compatible, so the matchesType's return value for mismatches converts to false and the value for matches and pedantic mismatches converts to true. This way most uses are unchanged and the code only distinguishes between matches and pedantic mismatches in four checks.</div><div class=""><br class=""></div></div><span id="cid:D13557C0-1D68-4B58-BB57-ED46A72FDAC5@zoomtown.com"><0001-Add-a-format-warning-for-p-with-non-void-args.patch></span><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""></div></div></blockquote></div></body></html>