Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115644576
D40264.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40264.diff
View Options
diff --git a/usr.bin/ctags/C.c b/usr.bin/ctags/C.c
--- a/usr.bin/ctags/C.c
+++ b/usr.bin/ctags/C.c
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include <limits.h>
+#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -261,6 +262,9 @@
{
int c; /* current character */
int level = 0; /* for matching '()' */
+ static char attribute[] = "__attribute__";
+ char maybe_attribute[sizeof attribute + 1],
+ *anext;
/*
* Find the end of the assumed function declaration.
@@ -298,10 +302,37 @@
* is a token character if it's a function and a non-token
* character if it's a declaration. Comments don't count...
*/
- for (;;) {
+ for (anext = maybe_attribute;;) {
while (GETC(!=, EOF) && iswhite(c))
if (c == '\n')
SETLINE;
+ if (c == EOF)
+ return NO;
+ /*
+ * Recognize the gnu __attribute__ extension, which would
+ * otherwise make the heuristic test DTWT
+ */
+ if (anext == maybe_attribute) {
+ if (intoken(c)) {
+ *anext++ = c;
+ continue;
+ }
+ } else {
+ if (intoken(c)) {
+ if (anext - maybe_attribute
+ < (ptrdiff_t)(sizeof attribute - 1))
+ *anext++ = c;
+ else break;
+ continue;
+ } else {
+ *anext++ = '\0';
+ if (strcmp(maybe_attribute, attribute) == 0) {
+ (void)ungetc(c, inf);
+ return NO;
+ }
+ break;
+ }
+ }
if (intoken(c) || c == '{')
break;
if (c == '/' && (GETC(==, '*') || c == '/'))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 11:46 AM (15 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17817137
Default Alt Text
D40264.diff (1 KB)
Attached To
Mode
D40264: ctags: Recognize __attribute__ in function declarations.
Attached
Detach File
Event Timeline
Log In to Comment