aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorAndreas Schwab2011-12-25 10:55:37 +0100
committerAndreas Schwab2011-12-25 10:55:37 +0100
commit28796b3a4a606e835300ce853c17a24e90da9bf0 (patch)
treeceef7dd0826d147970c0e8e392c8d6c25d1cb2a6 /lib-src
parentca22b785992df70ddc30ec471484e0204a384277 (diff)
downloademacs-28796b3a4a606e835300ce853c17a24e90da9bf0.tar.gz
emacs-28796b3a4a606e835300ce853c17a24e90da9bf0.zip
* etags.c (C_entries): Properly skip over string and character
constants inside brackets. (Bug#10357)
Diffstat (limited to 'lib-src')
-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 @@
12011-12-25 Andreas Schwab <schwab@linux-m68k.org>
2
3 * etags.c (C_entries): Properly skip over string and character
4 constants and comments inside brackets. (Bug#10357)
5
12011-12-04 Juanma Barranquero <lekktu@gmail.com> 62011-12-04 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * emacsclient.c (decode_options) [WINDOWSNT]: Don't force tty = 0; 8 * 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)
3189 } 3189 }
3190 continue; 3190 continue;
3191 } 3191 }
3192 else if (bracketlev > 0)
3193 {
3194 switch (c)
3195 {
3196 case ']':
3197 if (--bracketlev > 0)
3198 continue;
3199 break;
3200 case '\0':
3201 CNL_SAVE_DEFINEDEF ();
3202 break;
3203 }
3204 continue;
3205 }
3206 else switch (c) 3192 else switch (c)
3207 { 3193 {
3208 case '"': 3194 case '"':
3209 inquote = TRUE; 3195 inquote = TRUE;
3196 if (bracketlev > 0)
3197 continue;
3210 if (inattribute) 3198 if (inattribute)
3211 break; 3199 break;
3212 switch (fvdef) 3200 switch (fvdef)
@@ -3224,9 +3212,11 @@ C_entries (int c_ext, FILE *inf)
3224 continue; 3212 continue;
3225 case '\'': 3213 case '\'':
3226 inchar = TRUE; 3214 inchar = TRUE;
3215 if (bracketlev > 0)
3216 continue;
3227 if (inattribute) 3217 if (inattribute)
3228 break; 3218 break;
3229 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore) 3219 if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
3230 { 3220 {
3231 fvextern = FALSE; 3221 fvextern = FALSE;
3232 fvdef = fvnone; 3222 fvdef = fvnone;
@@ -3238,6 +3228,8 @@ C_entries (int c_ext, FILE *inf)
3238 incomm = TRUE; 3228 incomm = TRUE;
3239 lp++; 3229 lp++;
3240 c = ' '; 3230 c = ' ';
3231 if (bracketlev > 0)
3232 continue;
3241 } 3233 }
3242 else if (/* cplpl && */ *lp == '/') 3234 else if (/* cplpl && */ *lp == '/')
3243 { 3235 {
@@ -3270,7 +3262,7 @@ C_entries (int c_ext, FILE *inf)
3270 for (cp = newlb.buffer; cp < lp-1; cp++) 3262 for (cp = newlb.buffer; cp < lp-1; cp++)
3271 if (!iswhite (*cp)) 3263 if (!iswhite (*cp))
3272 { 3264 {
3273 if (*cp == '*' && *(cp+1) == '/') 3265 if (*cp == '*' && cp[1] == '/')
3274 { 3266 {
3275 cp++; 3267 cp++;
3276 cpptoken = TRUE; 3268 cpptoken = TRUE;
@@ -3284,7 +3276,17 @@ C_entries (int c_ext, FILE *inf)
3284 continue; 3276 continue;
3285 case '[': 3277 case '[':
3286 bracketlev++; 3278 bracketlev++;
3287 continue; 3279 continue;
3280 default:
3281 if (bracketlev > 0)
3282 {
3283 if (c == ']')
3284 --bracketlev;
3285 else if (c == '\0')
3286 CNL_SAVE_DEFINEDEF ();
3287 continue;
3288 }
3289 break;
3288 } /* switch (c) */ 3290 } /* switch (c) */
3289 3291
3290 3292