<br><br><div class="gmail_quote">On Wed, Jul 4, 2012 at 9:53 PM, Arnaud de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.adegm@gmail.com" target="_blank">arnaud.adegm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One comment from Doug on my patch adding CompilationDatabase to libclang was<br>
about fprinf which should not be used.<br>
<br>
I intend to clean this. I however found out that libclang is using fprintf in<br>
several places. I am proposing to clean this up as well while I am at it.<br>
<br>
I am asking here for advices / thoughts / preferences so that I can propose a<br>
patch which at least goes in the right direction :)<br>
<br>
The requirement : no api change to libclang. Existing code should continue to<br>
work as is.<br>
<br>
What are our available options ?<br>
<br>
 #1 just rip it off. Not very friendly, starting with ourselves, as those<br>
messages help diagnosing the error cause.<br>
<br>
 #2 implement something `a la` errno / strerror<br>
    Questions :<br>
       - how do we want to handle thread safety ? TLS ?<br>
       - do we only provide static const strings the user does not need to<br>
free or dynamically generated messages (the case today), requiring user<br>
actions to cleanup.<br>
<br></blockquote><div><br>As far as cleanup is concerned, either one of:<br>- clean it up the next time a function returns<br>- clean it up right before putting a new message there<br>- simply use a static buffer of fixed length<br>
<br>Note: the callback idea will also have to deal with cleanup.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 #3 have the user (optionnaly) register a callback function which is used to<br>
convey more information than a simple error code. I like this one as the user<br>
does not pay for what he does not use.<br>
<br>
 # other scheme ?<br>
<br>
Thoughts ?<br>
<br>
Cheers,<br>
--<br>
Arnaud de Grandmaison<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>
</blockquote></div><br>