Another way is to use a clang plugin to generate a more accurate list of definitions and call sites.<div>That's what I would do, because clang would handle all of the macro and language parsing. <span></span><br><br>On Monday, 1 April 2013, Thomas Arnhold wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
there are several unused methods in the source which callcatcher doesn't catch. Two examples: 08b91c63131b7e625d2a2c489bc537<u></u>dafe5c5963 and c12ab867f282e783507fcf74ab5c90<u></u>e784681f65 which had only (virtual) definitions, but no calls.<br>
<br>
The same applies to inlines like 646daee253b69404591c006ec6e717<u></u>b6660af30b. Defined, but no calls.<br>
<br>
So the idea is to get something like a list of all methods in the project. First counting (virtual) definitions and second counting all calls.<br>
<br>
Counting the calls is not as easy as it seems. So I had the idea to preprocess the source files with -fpreprocessed -dD -E to get source files without comments and much other cruft removed (which may lead to false-positives). Counting in those files seems easier. So it would be 1st count definitions, 2nd count all occurrences. If they are equal there are no calls.<br>
<br>
This would be a way to find possible candidates for removal (excluding DLLPUBLIC stuff). Pros: platform independent. Cons: No macro expansion, if there are several independent methods which have the same name, but one is unused it's not possible to identify the unused one. So it will only identify a fraction of all unused stuff. The question is how big is this fraction ;)<br>
<br>
So my question: Is it worth doing this (because it's not the cleanest way)? Or did I miss something, especially the point "no calls, no users"?<br>
<br>
<br>
Another possible way: gcc with -fdata-sections and -ffunction-sections [1]. Where both results could be compared and unused methods could be identified. But I didn't try that. Did anyone do such thing?<br>
<br>
Thomas<br>
<br>
<br>
[1] <a href="http://embeddedfreak.wordpress.com/2009/02/10/removing-unused-functionsdead-codes-with-gccgnu-ld/" target="_blank">http://embeddedfreak.<u></u>wordpress.com/2009/02/10/<u></u>removing-unused-functionsdead-<u></u>codes-with-gccgnu-ld/</a><br>
______________________________<u></u>_________________<br>
LibreOffice mailing list<br>
<a>LibreOffice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libreoffice" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/libreoffice</a><br>
</blockquote></div>