* etags does not recognize function definition in C file
@ 2007-11-14 8:53 Alexandru Harsanyi
2007-11-15 8:28 ` Masatake YAMATO
0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Harsanyi @ 2007-11-14 8:53 UTC (permalink / raw
To: emacs-pretest-bug
This is actually a bug in the etags program not emacs. For the
following C
file:
-----
#include <stdio.h>
int flag = 1;
void foo()
{
if (flag)
{
// bar();
}
}
void bar()
{
printf("bar\n");
}
void baz()
{
printf("baz\n");
}
-----
If I generate a TAGS file using the command:
etags tags_bug.c
the resulting TAGS file will not contain an entry for the 'bar'
function. I
believe this is caused by the empty if block in the 'foo' function.
If I
uncomment that line, the TAGS file will contain an entry for 'bar'.
Best Regards,
Alex.
In GNU Emacs 22.1.50.2 (powerpc-apple-darwin8.9.0, Carbon Version 1.6.0)
of 2007-06-09 on karinji.local
Windowing system distributor `Apple Inc.', version 10.4.10
configured using `configure '--enable-carbon-app''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: iso-8859-1
default-enable-multibyte-characters: t
Major mode: C/lw
Minor modes in effect:
whitespace-mode: t
shell-dirtrack-mode: t
c-subword-mode: t
encoded-kbd-mode: t
show-paren-mode: t
global-cwarn-mode: t
cwarn-mode: t
display-time-mode: t
whitespace-global-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: identity
abbrev-mode: t
Recent input:
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <down-mouse-1>
<mouse-movement> <mouse-1> <down-mouse-1> <mouse-1>
<down-mouse-1> <mouse-1> C-c t C-a <down-mouse-1> <mouse-1>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1>
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-movement>
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-movement>
<mouse-1> <down-mouse-1> <mouse-movement> <mouse-1>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-movement>
<mouse-1> <down-mouse-1> <mouse-1> C-x C-f ~ / O t
h <tab> t a g s _ b u g . c c <return> C-x C-v C-e
<backspace> <return> C-y C-x C-s <return> C-x C-s M-x
s h e l l <return> M-x c d o b <return> <return> l
s SPC - l <return> t a g s <backspace> <backspace>
<backspace> <backspace> / o p t <tab> e m <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
u s <tab> l o <tab> b i n <tab> e t <tab> t a g <tab>
<return> l SPC s - l <backspace> <backspace> <backspace>
<backspace> s SPC - l <return> C-x C-f T A G <tab>
<return> <down> <down> <down> <down> <up> <down> <down>
<down> C-x b C-s <return> <up> <down> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <right>
<right> <right> <up> <up> <up> <up> <up> <down> <down>
<down> <down> <down> C-a C-e <left> <left> <left> <C-backspace>
b a r C-x C-s C-a C-d C-d C-x C-s <tab> C-x C-s C-x
b C-s <C-return> <C-return> g C-g C-x b C-s <return>
M-p M-p <return> C-x C-f T A G <tab> <return> y e s
<return> C-x b <return> C-x b C-s <return> <up> <down>
C-a / / C-x C-s C-x b <return> M-p <return> C-x C-b
x <backspace> C-x 1 C-x b C-g C-x C-f T A G <tab> <return>
y e s <return> C-x b <return> C-x b C-s <return> M-x
r e p o r <tab> e m <tab> <return>
Recent messages:
Partially completed
Wrote /Users/haral/Other/tags_bug.c [2 times]
(No changes need to be saved)
Quit
History item: 1
History item: 2
Wrote /Users/haral/Other/tags_bug.c
History item: 1
Quit
Loading emacsbug...done
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: etags does not recognize function definition in C file
2007-11-14 8:53 etags does not recognize function definition in C file Alexandru Harsanyi
@ 2007-11-15 8:28 ` Masatake YAMATO
2007-11-15 12:16 ` Francesco Potorti`
2007-11-16 8:06 ` Alexandru Harsanyi
0 siblings, 2 replies; 5+ messages in thread
From: Masatake YAMATO @ 2007-11-15 8:28 UTC (permalink / raw
To: harsanyi; +Cc: emacs-pretest-bug, pot, emacs-devel
[-- Attachment #1: Type: Text/Plain, Size: 1038 bytes --]
Hi,
Thank you for reporting the bug.
Following patch for etags.c in the latest emacs CVS repository may fix the
problem you reported. However, I'm not sure this fix is really o.k.
Please, test this.
I shortened the test case to make tracking the automaton easier:
T f(){if(x){}
}T i;
and
T f(){if(x){;}
}T i;
2007-11-15 Masatake YAMATO <jet@gyve.org>
* etags.c (C_entries): Set fvnone to fvdef in
the case (!ignoreindent && lp == newlb.buffer + 1).
--- etags.c 17 8æ 2007 05:09:37 +0900 3.77
+++ etags.c 15 11æ 2007 17:20:33 +0900
@@ -4006,9 +4006,10 @@
bracelev = 0;
token.valid = FALSE; /* something gone amiss, token unreliable */
}
- if (bracelev == 0 && fvdef == vignore)
- fvdef = fvnone; /* end of function */
}
+ if (bracelev == 0 && fvdef == vignore)
+ fvdef = fvnone; /* end of function */
+
popclass_above (bracelev);
structdef = snone;
/* Only if typdef == tinbody is typdefbracelev significant. */
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: etags does not recognize function definition in C file
2007-11-15 8:28 ` Masatake YAMATO
@ 2007-11-15 12:16 ` Francesco Potorti`
2007-11-15 12:44 ` Masatake YAMATO
2007-11-16 8:06 ` Alexandru Harsanyi
1 sibling, 1 reply; 5+ messages in thread
From: Francesco Potorti` @ 2007-11-15 12:16 UTC (permalink / raw
To: Masatake YAMATO; +Cc: emacs-pretest-bug, harsanyi, emacs-devel
Thank you, Masatake. Your patch is the right thing. I checked it by
code inspection and by running my test suite. If you haven't already, I
will install it.
>2007-11-15 Masatake YAMATO <jet@gyve.org>
>
> * etags.c (C_entries): Set fvnone to fvdef in
> the case (!ignoreindent && lp == newlb.buffer + 1).
>
>--- etags.c 17 8æ 2007 05:09:37 +0900 3.77
>+++ etags.c 15 11æ 2007 17:20:33 +0900
>@@ -4006,9 +4006,10 @@
> bracelev = 0;
> token.valid = FALSE; /* something gone amiss, token unreliable */
> }
>- if (bracelev == 0 && fvdef == vignore)
>- fvdef = fvnone; /* end of function */
> }
>+ if (bracelev == 0 && fvdef == vignore)
>+ fvdef = fvnone; /* end of function */
>+
> popclass_above (bracelev);
> structdef = snone;
> /* Only if typdef == tinbody is typdefbracelev significant. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: etags does not recognize function definition in C file
2007-11-15 12:16 ` Francesco Potorti`
@ 2007-11-15 12:44 ` Masatake YAMATO
0 siblings, 0 replies; 5+ messages in thread
From: Masatake YAMATO @ 2007-11-15 12:44 UTC (permalink / raw
To: pot; +Cc: emacs-pretest-bug, harsanyi, emacs-devel
> Thank you, Masatake. Your patch is the right thing. I checked it by
> code inspection and by running my test suite. If you haven't already, I
> will install it.
Thank you for reviewing.
I haven't yet. Please install it.
Masatake
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: etags does not recognize function definition in C file
2007-11-15 8:28 ` Masatake YAMATO
2007-11-15 12:16 ` Francesco Potorti`
@ 2007-11-16 8:06 ` Alexandru Harsanyi
1 sibling, 0 replies; 5+ messages in thread
From: Alexandru Harsanyi @ 2007-11-16 8:06 UTC (permalink / raw
To: Masatake YAMATO; +Cc: Emacs Devel
On 15 Nov 2007, at 5:28 PM, Masatake YAMATO wrote:
> Hi,
>
> Thank you for reporting the bug.
>
> Following patch for etags.c in the latest emacs CVS repository may
> fix the
> problem you reported. However, I'm not sure this fix is really o.k.
> Please, test this.
Hi Masatake,
I tested the fix using the original file and indeed the problem is
fixed.
Thanks you,
Alex.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-16 8:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14 8:53 etags does not recognize function definition in C file Alexandru Harsanyi
2007-11-15 8:28 ` Masatake YAMATO
2007-11-15 12:16 ` Francesco Potorti`
2007-11-15 12:44 ` Masatake YAMATO
2007-11-16 8:06 ` Alexandru Harsanyi
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).