bug-global
[Top][All Lists]
Advanced

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

[PATCH] allow new-line in typedef


From: Hideki IWAMOTO
Subject: [PATCH] allow new-line in typedef
Date: Tue, 25 Mar 2003 21:48:14 +0900

>cat k.c

typedef
struct {
        int a;
} foo;

[current cvs version]
>gctags -dtw k.c
a                   4 k.c               int a;
Warning: missing left '{' [+5 k.c].

[patched version]
>gctags -dtw k.c
foo                 5 k.c              } foo;


Index: gctags/C.c
===================================================================
RCS file: /cvsroot/global/global/gctags/C.c,v
retrieving revision 1.33
diff -u -r1.33 C.c
--- gctags/C.c  21 Mar 2003 01:17:02 -0000      1.33
+++ gctags/C.c  25 Mar 2003 12:40:51 -0000
@@ -299,7 +299,7 @@
                                /* skip type qualifiers */
                                do {
                                        c = nexttoken("{}(),;", reserved);
-                               } while (IS_TYPE_QUALIFIER(c));
+                               } while (IS_TYPE_QUALIFIER(c) || c == '\n');
 
                                if (wflag && c == EOF) {
                                        fprintf(stderr, "Warning: unexpected 
eof. [+%d %s]\n", lineno, curfile);
Index: gctags/Cpp.c
===================================================================
RCS file: /cvsroot/global/global/gctags/Cpp.c,v
retrieving revision 1.30
diff -u -r1.30 Cpp.c
--- gctags/Cpp.c        21 Mar 2003 01:17:02 -0000      1.30
+++ gctags/Cpp.c        25 Mar 2003 12:40:52 -0000
@@ -341,7 +341,12 @@
                                int     typedef_savelevel = level;
 
                                savetok[0] = 0;
-                               c = nexttoken("{}(),;", reserved);
+
+                               /* skip CV qualifiers */
+                               do {
+                                       c = nexttoken("{}(),;", reserved);
+                               } while (IS_CV_QUALIFIER(c) || c == '\n');
+
                                if (wflag && c == EOF) {
                                        fprintf(stderr, "Warning: unexpected 
eof. [+%d %s]\n", lineno, curfile);
                                        break;
Index: gctags/Cpp.h
===================================================================
RCS file: /cvsroot/global/global/gctags/Cpp.h,v
retrieving revision 1.8
diff -u -r1.8 Cpp.h
--- gctags/Cpp.h        21 Mar 2003 01:17:02 -0000      1.8
+++ gctags/Cpp.h        25 Mar 2003 12:40:52 -0000
@@ -113,3 +113,5 @@
 
 #define MAXCOMPLETENAME 1024            /* max size of complete name of class 
*/
 #define MAXCLASSSTACK   100             /* max size of class stack */
+
+#define IS_CV_QUALIFIER(c)     ((c) == CPP_CONST || (c) == CPP_VOLATILE)

----
Hideki IWAMOTO  address@hidden




reply via email to

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