ctags would create a corrupt tags file if the source C file used '//' style
comments such as: // The main() function Teach ctags about this style of commenting. Submitted by: Eric Allman <eric@Sendmail.ORG> MFC after: 1 week
This commit is contained in:
parent
d7bbec76f2
commit
b24e2c8a23
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91189
@ -122,8 +122,8 @@ c_entries()
|
|||||||
* "foo() XX comment XX { int bar; }"
|
* "foo() XX comment XX { int bar; }"
|
||||||
*/
|
*/
|
||||||
case '/':
|
case '/':
|
||||||
if (GETC(==, '*')) {
|
if (GETC(==, '*') || c == '/') {
|
||||||
skip_comment();
|
skip_comment(c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(void)ungetc(c, inf);
|
(void)ungetc(c, inf);
|
||||||
@ -273,8 +273,8 @@ func_entry()
|
|||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
/* skip comments */
|
/* skip comments */
|
||||||
if (GETC(==, '*'))
|
if (GETC(==, '*') || c == '/')
|
||||||
skip_comment();
|
skip_comment(c);
|
||||||
break;
|
break;
|
||||||
case '(':
|
case '(':
|
||||||
level++;
|
level++;
|
||||||
@ -301,8 +301,8 @@ func_entry()
|
|||||||
SETLINE;
|
SETLINE;
|
||||||
if (intoken(c) || c == '{')
|
if (intoken(c) || c == '{')
|
||||||
break;
|
break;
|
||||||
if (c == '/' && GETC(==, '*'))
|
if (c == '/' && (GETC(==, '*') || c == '/'))
|
||||||
skip_comment();
|
skip_comment(c);
|
||||||
else { /* don't ever "read" '/' */
|
else { /* don't ever "read" '/' */
|
||||||
(void)ungetc(c, inf);
|
(void)ungetc(c, inf);
|
||||||
return (NO);
|
return (NO);
|
||||||
@ -422,7 +422,8 @@ str_entry(c)
|
|||||||
* skip over comment
|
* skip over comment
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
skip_comment()
|
skip_comment(t)
|
||||||
|
int t; /* comment character */
|
||||||
{
|
{
|
||||||
int c; /* character read */
|
int c; /* character read */
|
||||||
int star; /* '*' flag */
|
int star; /* '*' flag */
|
||||||
@ -434,10 +435,12 @@ skip_comment()
|
|||||||
star = YES;
|
star = YES;
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
if (star)
|
if (star && t == '*')
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
|
if (t == '/')
|
||||||
|
return;
|
||||||
SETLINE;
|
SETLINE;
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
default:
|
default:
|
||||||
@ -500,8 +503,8 @@ skip_key(key)
|
|||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
/* skip comments */
|
/* skip comments */
|
||||||
if (GETC(==, '*')) {
|
if (GETC(==, '*') || c == '/') {
|
||||||
skip_comment();
|
skip_comment(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void)ungetc(c, inf);
|
(void)ungetc(c, inf);
|
||||||
|
@ -97,4 +97,4 @@ extern void l_entries __P((void));
|
|||||||
extern void y_entries __P((void));
|
extern void y_entries __P((void));
|
||||||
extern int PF_funcs __P((void));
|
extern int PF_funcs __P((void));
|
||||||
extern void c_entries __P((void));
|
extern void c_entries __P((void));
|
||||||
extern void skip_comment __P((void));
|
extern void skip_comment __P((int));
|
||||||
|
@ -85,8 +85,8 @@ y_entries()
|
|||||||
(void)ungetc(c, inf);
|
(void)ungetc(c, inf);
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
if (GETC(==, '*'))
|
if (GETC(==, '*') || c == '/')
|
||||||
skip_comment();
|
skip_comment(c);
|
||||||
else
|
else
|
||||||
(void)ungetc(c, inf);
|
(void)ungetc(c, inf);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user