tomm@voodoo.voodoo.uucp (Tom Mackey) (10/31/90)
I'm trying to DoTheRightThing and use full function prototyping and have run into a little problem with ctags. I wonder whether there is a problem with the parsing mechanism in ctags, or if I am doing the prototypes incorrectly. Allow me to demonstrate. I am writing a declaration for a function which takes a pointer to an integer, a pointer to a function which returns void and itself takes a pointer to void (generic pointer), and a third parameter which is a pointer to void. Here's the declaration: void my_func(int *, void ((*fn)(void *)), void *); And here is a definition, body left empty since it is immaterial to the discussion at hand: void my_func(int *flag, void (*sfunc)(void *), void *arg) { /* Do Whatever */ } Now, if I run ctags on this, here is what I get: Script started on Tue Oct 30 10:52:37 1990 tomm logging onto hank:/dev/ttyq7 at 10:52:37 AM on Tue 30_Oct_90 % cat foo.c void my_func(int *, void (*fn)(void *), void *); void my_func(int *flag, void (*sfunc)(void *), void *arg) { /* Do Whatever */ } % ctags foo.c Duplicate entry in file foo.c, line 3: my_func Second entry ignored % cat tags my_func foo.c /^void my_func(int *, void (*fn)(void *), void *)/ % exit % script done on Tue Oct 30 10:52:56 1990 OK. Now I'll reduce the declaration by removing most of that function pointer prototype: Script started on Tue Oct 30 11:08:45 1990 tomm logging onto hank:/dev/ttyq7 at 11:08:45 AM on Tue 30_Oct_90 % cat foo.c void my_func(int *, void (*fn), void *); void my_func(int *flag, void (*sfunc)(void *), void *arg) { /* Do Whatever */ } % ctags foo.c % cat tags my_func foo.c /^void my_func(int *flag, void (*sfunc)(void *), voi/ % exit % script done on Tue Oct 30 11:09:00 1990 That worked OK.... tags contains the actual function definition. Now I'll add back in the paren-pair for the function pointer: Script started on Tue Oct 30 11:11:01 1990 tomm logging onto hank:/dev/ttyq7 at 11:11:01 AM on Tue 30_Oct_90 ca% t foo.c void my_func(int *, void (*fn)(), void *); void my_func(int *flag, void (*sfunc)(void *), void *arg) { /* Do Whatever */ } % ctags foo.c Duplicate entry in file foo.c, line 3: my_func Second entry ignored % cat tags my_func foo.c /^void my_func(int *, void (*fn)(), void *);$/ % exit % script done on Tue Oct 30 11:11:22 1990 Oops! Bad news. The tags file contains the function declaration. What gives? Any ideas? -- Tom Mackey (206) 865-6575 tomm@voodoo.boeing.com Boeing Computer Services ....uunet!bcstec!voodoo!tomm M/S 7K-20, P.O. Box 24346, Seattle, WA 98124-0346
tomm@uucp (Tom Mackey) (10/31/90)
In article <515@voodoo.UUCP> tomm@voodoo.voodoo.uucp (Tom Mackey) writes: > > I'm trying to DoTheRightThing and use full function prototyping > and have run into a little problem with ctags. I wonder whether <Most of my previous drivel ommitted> A co-worker just popped in and said he thought he had seen something about this 3 or so weeks ago. I just got caught up in c.s.sgi, so it may have expired. He said there may have been something about it being a known bug and was to be fixed in Release 3.3 of the OS. I am running Release 3.3.1 on a 4D/25TG. -- Tom Mackey (206) 865-6575 tomm@voodoo.boeing.com Boeing Computer Services ....uunet!bcstec!voodoo!tomm M/S 7K-20, P.O. Box 24346, Seattle, WA 98124-0346
tomm@uucp (Tom Mackey) (11/03/90)
In article <517@voodoo.UUCP> tomm@uucp (Tom Mackey) writes: >In article <515@voodoo.UUCP> tomm@voodoo.voodoo.uucp (Tom Mackey) writes: >> I'm trying to DoTheRightThing and use full function prototyping >> and have run into a little problem with ctags. I wonder whether > <Most of my previous drivel ommitted> >A co-worker just popped in and said he thought he had seen something >about this 3 or so weeks ago. I just got caught up in c.s.sgi, so it >may have expired. He said there may have been something about it >being a known bug and was to be fixed in Release 3.3 of the OS. I am >running Release 3.3.1 on a 4D/25TG. < Didja ever get the feeling no one's listening and yer just talking to yerself? ;^) > Here is a workaround to the ctags and prototypes problem that I've been discussing with myself: /* ** The following cheap trick is made necessary by a broken ctags(1). ** Ctags is fooled by function prototypes containing pointer to ** function declarations, so we hide them in a define. Now lint(1) ** stays happy, too! */ #define PARMLIST1 void (*fn)(void *, int) #define PARMLIST2 void (*fn)(void *) void add_event(event_pp, int, int, int, PARMLIST1, void *); void add_update(update_pp, int *, PARMLIST2, void *); Enjoy! -- Tom Mackey (206) 865-6575 tomm@voodoo.boeing.com Boeing Computer Services ....uunet!bcstec!voodoo!tomm M/S 7K-20, P.O. Box 24346, Seattle, WA 98124-0346