[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] move some code into condition_macro
From: |
Hideki IWAMOTO |
Subject: |
[PATCH] move some code into condition_macro |
Date: |
Mon, 10 Mar 2003 08:20:32 +0900 |
Index: gctags/C.c
===================================================================
RCS file: /cvsroot/global/global/gctags/C.c,v
retrieving revision 1.23
diff -u -r1.23 C.c
--- gctags/C.c 5 Mar 2003 16:04:12 -0000 1.23
+++ gctags/C.c 9 Mar 2003 23:06:23 -0000
@@ -45,7 +45,7 @@
#include "token.h"
static int function_definition(int);
-static void condition_macro(int);
+static void condition_macro(int, int);
static int seems_datatype(const char *);
static void inittable();
static int reserved(char *);
@@ -257,17 +257,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(cc);
- while ((c = nexttoken(interested, reserved)) != EOF &&
c != '\n') {
- if (!strcmp(token, "defined"))
- continue;
- if (c == SYMBOL
- && (dflag
- ? ((target == REF && defined(token))
- || (target == SYM &&
!defined(token)))
- : target == SYM))
- PUT(token, lineno, sp);
- }
+ condition_macro(cc, target);
break;
case CP_SHARP: /* ## */
(void)nexttoken(interested, reserved);
@@ -333,7 +323,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c,
target);
continue;
default:
break;
@@ -393,7 +383,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -467,7 +457,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -498,7 +488,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -536,10 +526,12 @@
* condition_macro:
*
* i) cc token
+ * i) target current target
*/
static void
-condition_macro(cc)
+condition_macro(cc, target)
int cc;
+ int target;
{
cur = &stack[piflevel];
if (cc == CP_IFDEF || cc == CP_IFNDEF || cc == CP_IF) {
@@ -584,6 +576,15 @@
level = cur->end;
}
}
+ }
+ while ((cc = nexttoken(NULL, reserved)) != EOF && cc != '\n') {
+ if (cc == SYMBOL && strcmp(token, "defined") != 0
+ && (dflag
+ ? (defined(token)
+ ? target == REF
+ : target == SYM)
+ : target == SYM))
+ PUT(token, lineno, sp);
}
}
/*
Index: gctags/Cpp.c
===================================================================
RCS file: /cvsroot/global/global/gctags/Cpp.c,v
retrieving revision 1.21
diff -u -r1.21 Cpp.c
--- gctags/Cpp.c 5 Mar 2003 16:04:12 -0000 1.21
+++ gctags/Cpp.c 9 Mar 2003 23:06:23 -0000
@@ -47,7 +47,7 @@
static int function_definition(int);
static int seems_datatype(const char *);
-static void condition_macro(int);
+static void condition_macro(int, int);
static void inittable();
static int reserved(char *);
@@ -259,17 +259,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(cc);
- while ((c = nexttoken(interested, reserved)) != EOF &&
c != '\n') {
- if (!strcmp(token, "defined"))
- continue;
- if (c == SYMBOL
- && (dflag
- ? ((target == REF && defined(token))
- || (target == SYM &&
!defined(token)))
- : target == SYM))
- PUT(token, lineno, sp);
- }
+ condition_macro(cc, target);
break;
case CP_SHARP: /* ## */
(void)nexttoken(interested, reserved);
@@ -379,7 +369,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c,
target);
continue;
default:
break;
@@ -439,7 +429,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -513,7 +503,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -548,7 +538,7 @@
case CP_ELIF:
case CP_ELSE:
case CP_ENDIF:
- condition_macro(c);
+ condition_macro(c, target);
continue;
default:
break;
@@ -585,10 +575,12 @@
* condition_macro:
*
* i) cc token
+ * i) target current target
*/
static void
-condition_macro(cc)
+condition_macro(cc, target)
int cc;
+ int target;
{
cur = &pifstack[piflevel];
if (cc == CP_IFDEF || cc == CP_IFNDEF || cc == CP_IF) {
@@ -633,6 +625,15 @@
level = cur->end;
}
}
+ }
+ while ((cc = nexttoken(NULL, reserved)) != EOF && cc != '\n') {
+ if (cc == SYMBOL && strcmp(token, "defined") != 0
+ && (dflag
+ ? (defined(token)
+ ? target == REF
+ : target == SYM)
+ : target == SYM))
+ PUT(token, lineno, sp);
}
}
/*
----
Hideki IWAMOTO address@hidden
- [PATCH] move some code into condition_macro,
Hideki IWAMOTO <=