bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] skip type qualifiers which continues after typedef


From: Hideki IWAMOTO
Subject: [PATCH] skip type qualifiers which continues after typedef
Date: Fri, 07 Mar 2003 21:50:49 +0900

This patch is dependent on patch in 
http://mail.gnu.org/archive/html/bug-global/2003-03/msg00006.html

>cat t.c
typedef const struct {
        int             foo;
        double          bar;
} ZOO;

[current cvs version]
>gctags -dtw t.c
foo                 2 t.c               int             foo;
Warning: missing left '{' [+4 t.c].

[patched version]
>gctags -dtw t.c
ZOO                 4 t.c              } ZOO;



diff -ur -x CVS ../../global_org/global/gctags/C.c gctags/C.c
--- ../../global_org/global/gctags/C.c  Fri Mar  7 21:22:33 2003
+++ gctags/C.c  Fri Mar  7 21:23:31 2003
@@ -310,7 +310,12 @@
                                int     typedef_savelevel = level;
 
                                savetok[0] = 0;
-                               c = nexttoken("{}(),;", reserved);
+
+                               /* skip type qualifiers */
+                               do {
+                                       c = nexttoken("{}(),;", reserved);
+                               } while (IS_TYPE_QUALIFIER(c));
+
                                if (wflag && c == EOF) {
                                        fprintf(stderr, "Warning: unexpected 
eof. [+%d %s]\n", lineno, curfile);
                                        break;
Only in gctags: C.c.orig
diff -ur -x CVS ../../global_org/global/gctags/C.h gctags/C.h
--- ../../global_org/global/gctags/C.h  Fri Mar  7 21:22:33 2003
+++ gctags/C.h  Fri Mar  7 01:46:39 2003
@@ -101,3 +101,5 @@
 #define IS_CTOKEN(c)   ((c) > CTOKEN_BASE && (c) < CTOKEN_BASE + 1000)
 #define IS_CPTOKEN(c)  ((c) > CPTOKEN_BASE && (c) < CPTOKEN_BASE + 1000)
 #define IS_YACCTOKEN(c)        ((c) > YACCTOKEN_BASE && (c) < YACCTOKEN_BASE + 
1000)
+
+#define IS_TYPE_QUALIFIER(c)   ((c) == C_CONST || (c) == C_RESTRICT || (c) == 
C_VOLATILE)

----
Hideki IWAMOTO  address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]