<p>In <a href="https://github.com/geany/geany/pull/957#discussion_r62072600">tagmanager/src/tm_ctags_wrappers.h</a>:</p>
<pre style='color:#555'>> + */
> +
> +#ifndef TM_CTAGS_WRAPPERS
> +#define TM_CTAGS_WRAPPERS
> +
> +#include <glib.h>
> +
> +#include "tm_parser.h"
> +
> +#include "entry.h" /* for sTagEntryInfo */
> +
> +
> +G_BEGIN_DECLS
> +
> +typedef gboolean (*tm_ctags_callback) (const tagEntryInfo *const tag,
> + gboolean invalidate, void *user_data);
</pre>
<p>AFAIK it's meant to recover from weird proeproc cases, i.e. imagine this C code:</p>
<div class="highlight highlight-source-c"><pre>#<span class="pl-k">define</span> <span class="pl-en">FOO</span> <span class="pl-c1">0</span>
<span class="pl-k">int</span> <span class="pl-en">main</span>(<span class="pl-k">void</span>)
{
#<span class="pl-k">if</span> FOO
<span class="pl-k">if</span> (<span class="pl-c1">1</span>) {
#endif
<span class="pl-c">// ...</span>
#<span class="pl-k">if</span> ! FOO
<span class="pl-c">// ...</span>
#<span class="pl-k">else</span>
}
#<span class="pl-k">endif</span>
<span class="pl-k">return</span> <span class="pl-c1">0</span>;
}
<span class="pl-k">int</span> <span class="pl-smi">foo</span>() {
}</pre></div>
<p>It has unmatched braces if you always take the first preproc branch.</p>
<p>However, AFAICT the current code can <em>never</em> hit: the <code>passCount</code> starts at 0 (I blamed it back to the initial revision), but the only code path setting <code>retry</code> to <code>TRUE</code> is guarded with <code>if (exception == ExceptionBraceFormattingError && passCount == 1)</code>, so it could only happen on the <em>second</em> pass, which can't itself won't happen as it won't ever retry.<br>
I imagine this is an oversight at some point and <code>passCount</code> shouldstart at 1, but indeed currently it seems like plain dead code.</p>
<p>U-Ctags doesn not have this bug, because it indeed starts passCount at one, by incrementing it before calling the rescanning parser: <code>createTagsForFile (fileName, language, ++passCount)</code>, so it does start at 1, not 0.<br>
With current version of the OldC parser (somewhat the one we have) you'll see it does output the <code>foo</code> tag we don't:</p>
<pre lang="terminal"><code>$ ./ctags --verbose --languages=OldC -o - file.c
...
OPENING file.c as OldC language file
/tmp/a.c: failed to find match for '{' at line 5
/tmp/a.c: retrying file with fallback brace matching algorithm
OPENING file.c as OldC language file
sorting tag file
system ("sort -u")
FOO file.c /^#define FOO /;" d file:
foo file.c /^int foo() {$/;" f
main file.c /^int main(void)$/;" f
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/geany/geany/pull/957/files/103d2c535862ae2682022dcfd714c2ffd983c42f..1c4aaa0eb72aa9e3c60cd604d4c20ca5f7dc5c8f#r62072600">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJw-6VAhitULjm4_YMokdLxKPzbhBks5p-MxEgaJpZM4Ht-Ad.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/geany/geany/pull/957/files/103d2c535862ae2682022dcfd714c2ffd983c42f..1c4aaa0eb72aa9e3c60cd604d4c20ca5f7dc5c8f#r62072600"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>