summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2011-12-25 10:55:37 +0100
committerAndreas Schwab <schwab@linux-m68k.org>2011-12-25 10:55:37 +0100
commit28796b3a4a606e835300ce853c17a24e90da9bf0 (patch)
treeceef7dd0826d147970c0e8e392c8d6c25d1cb2a6
parentca22b785992df70ddc30ec471484e0204a384277 (diff)
downloademacs-28796b3a4a606e835300ce853c17a24e90da9bf0.tar.gz
* etags.c (C_entries): Properly skip over string and character
constants inside brackets. (Bug#10357)
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/etags.c36
2 files changed, 24 insertions, 17 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 40404828e0f..e989473219c 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-25 Andreas Schwab <schwab@linux-m68k.org>
+
+ * etags.c (C_entries): Properly skip over string and character
+ constants and comments inside brackets. (Bug#10357)
+
2011-12-04 Juanma Barranquero <lekktu@gmail.com>
* emacsclient.c (decode_options) [WINDOWSNT]: Don't force tty = 0;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 30d90e9d911..8852c9faea4 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -3189,24 +3189,12 @@ C_entries (int c_ext, FILE *inf)
}
continue;
}
- else if (bracketlev > 0)
- {
- switch (c)
- {
- case ']':
- if (--bracketlev > 0)
- continue;
- break;
- case '\0':
- CNL_SAVE_DEFINEDEF ();
- break;
- }
- continue;
- }
else switch (c)
{
case '"':
inquote = TRUE;
+ if (bracketlev > 0)
+ continue;
if (inattribute)
break;
switch (fvdef)
@@ -3224,9 +3212,11 @@ C_entries (int c_ext, FILE *inf)
continue;
case '\'':
inchar = TRUE;
+ if (bracketlev > 0)
+ continue;
if (inattribute)
break;
- if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
+ if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
{
fvextern = FALSE;
fvdef = fvnone;
@@ -3238,6 +3228,8 @@ C_entries (int c_ext, FILE *inf)
incomm = TRUE;
lp++;
c = ' ';
+ if (bracketlev > 0)
+ continue;
}
else if (/* cplpl && */ *lp == '/')
{
@@ -3270,7 +3262,7 @@ C_entries (int c_ext, FILE *inf)
for (cp = newlb.buffer; cp < lp-1; cp++)
if (!iswhite (*cp))
{
- if (*cp == '*' && *(cp+1) == '/')
+ if (*cp == '*' && cp[1] == '/')
{
cp++;
cpptoken = TRUE;
@@ -3284,7 +3276,17 @@ C_entries (int c_ext, FILE *inf)
continue;
case '[':
bracketlev++;
- continue;
+ continue;
+ default:
+ if (bracketlev > 0)
+ {
+ if (c == ']')
+ --bracketlev;
+ else if (c == '\0')
+ CNL_SAVE_DEFINEDEF ();
+ continue;
+ }
+ break;
} /* switch (c) */