<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 24, 2015 at 9:50 AM, Seth Cantrell <span dir="ltr"><<a href="mailto:seth.cantrell@gmail.com" target="_blank">seth.cantrell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It seems reasonable for this kind of warning to go under some -pedantic flag, something like "-Wformat-pedantic".<br></blockquote><div><br>Possibly, though there's also a general aversion to adding off-by-default warnings to clang because they end up undertested and a burden on the codebase (in terms of complexity, etc) with relatively little value.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> On Feb 24, 2015, at 12:31 PM, David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br>
><br>
> On 21 Feb 2015, at 03:56, Rouben Rostamian <<a href="mailto:rostamian@umbc.edu">rostamian@umbc.edu</a>> wrote:<br>
>><br>
>> My question is: Why is it that removing the cast /does not/<br>
>> trigger a warning in Clang?  Do I need to specify further<br>
>> compilation flags to get that warning?<br>
><br>
> It used to generate a warning in clang but it was spectacularly annoying and so was removed because it generated a huge number of false positives.  The C standard does require that the argument for %p 'be a pointer to void', but the only platforms where any other data pointer (in the same address space) would be problematic are ones that do not natively support byte addressing and so need different pointer types for char* and void* and anything word aligned.  Clang does not support any such architectures and a lot of C code that people compile with clang / gcc would break on such architectures.<br>
><br>
> The choice is to either have a warning that you are violating the letter of the C spec, but that your code will still work on every platform that you're likely to ever care about (and I say this as someone working on an architecture with a very unusual pointer representation, for which this warning would *still* be a false positive), or to allow this code through.<br>
><br>
> Clang policy is that good code ought to be able to use -Wall -Werror by default, because warnings that have too high a false positive rate are not present.  If warnings are too likely to produce false positives (i.e. flag things that work fine on every system where the code is plausibly likely to run), then it doesn't help the programmer, it just makes them turn off the warning.<br>
><br>
> David<br>
><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div>