[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    Re: [cfe-commits] r140777 - in /cfe/trunk:
From:       David Blaikie <dblaikie () gmail ! com>
Date:       2011-09-30 18:19:52
Message-ID: CAENS6EsntCb3GgXSbkdUz-ZtO5Cg9MDUUmAKm1sHPSheV+XPbw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


>
> The 'format' attribute already states whether or not it takes 'printf' or
> 'scanf' format strings.  That's not really the issue here.
>

[I think Ahmed was saying that the format string annotation could say
whether it's a no-op on empty or not]


> The issue is whether or not the function is a no-op given an empty format
> string.  For a 'scanf' format string, it's clearly a no-op given no format
> string.  For a 'printf' format string, that's not necessarily the case.
>

Is it really the job of this warning to catch that case though? Lots of
functions are no-ops when passed certain arguments (write of zero length,
etc). While it's perhaps a "nice to have"/convenient thing we might be able
to get here for low cost compared to any attempt to tackle the general
problem, I'm not sure it's worth contorting things to satisfy when it was
more a coincidental win than an intentional one.

- David

[Attachment #5 (text/html)]

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex;"><div \
style="word-wrap:break-word">The &#39;format&#39; attribute already states whether or \
not it takes &#39;printf&#39; or &#39;scanf&#39; format strings.  That&#39;s not \
really the issue here.  </div> </blockquote><div><br></div><div>[I think Ahmed was \
saying that the format string annotation could say whether it&#39;s a no-op on empty \
or not]</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div \
style="word-wrap:break-word">The issue is whether or not the function is a no-op \
given an empty format string.  For a &#39;scanf&#39; format string, it&#39;s clearly \
a no-op given no format string.  For a &#39;printf&#39; format string, that&#39;s not \
necessarily the case.</div> </blockquote><div><br></div><div>Is it really the job of \
this warning to catch that case though? Lots of functions are no-ops when passed \
certain arguments (write of zero length, etc). While it&#39;s perhaps a &quot;nice to \
have&quot;/convenient thing we might be able to get here for low cost compared to any \
attempt to tackle the general problem, I&#39;m not sure it&#39;s worth contorting \
things to satisfy when it was more a coincidental win than an intentional one.</div> \
<div><br></div><div>- David</div></div>



_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic