Deleted Added
sdiff udiff text old ( 178529 ) new ( 178546 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 62 unchanged lines hidden (view full) ---

71static char *id(char *cp, int *h);
72static char *whitesp(char *cp);
73static void addhash(tdesc_t *tdp, int num);
74static int tagadd(char *w, int h, tdesc_t *tdp);
75static char *tdefdecl(char *cp, int h, tdesc_t **rtdp);
76static char *intrinsic(char *cp, tdesc_t **rtdp);
77static char *arraydef(char *cp, tdesc_t **rtdp);
78
79extern int debug_level;
80int debug_parse = DEBUG_PARSE;
81
82/*PRINTFLIKE3*/
83static void
84parse_debug(int level, char *cp, char *fmt, ...)
85{
86 va_list ap;
87 char buf[1024];
88 char tmp[32];
89 int i;
90
91 if (level > debug_level || !debug_parse)
92 return;

--- 15 unchanged lines hidden (view full) ---

108 va_start(ap, fmt);
109 vadebug(level, buf, ap);
110 va_end(ap);
111}
112
113/* Report unexpected syntax in stabs. */
114static void
115_expected(
116 char *who, /* what function, or part thereof, is reporting */
117 char *what, /* what was expected */
118 char *where, /* where we were in the line of input */
119 int line)
120{
121 fprintf(stderr, "%s, expecting \"%s\" at \"%s\"\n", who, what, where);
122 fprintf(stderr, "code line: %d, file %s\n", line,
123 (curhdr ? curhdr : "NO FILE"));
124 reset();
125}
126
127/*ARGSUSED*/
128void
129parse_init(tdata_t *td)
130{
131 int i;
132
133 for (i = 0; i < BUCKETS; i++) {
134 hash_table[i] = NULL;
135 name_table[i] = NULL;
136 }
137

--- 16 unchanged lines hidden (view full) ---

154
155 tdp = xcalloc(sizeof (*tdp));
156 tdp->t_type = TYPEDEF_UNRES;
157 tdp->t_id = tid;
158
159 return (tdp);
160}
161
162char *
163read_tid(char *cp, tdesc_t **tdpp)
164{
165 tdesc_t *tdp;
166 int tid;
167
168 cp = id(cp, &tid);
169
170 assert(tid != 0);

--- 14 unchanged lines hidden (view full) ---

185
186 *tdpp = tdp;
187 return (cp);
188}
189
190static iitype_t
191parse_fun(char *cp, iidesc_t *ii)
192{
193 iitype_t iitype;
194 tdesc_t *tdp;
195 tdesc_t **args = NULL;
196 int nargs = 0;
197 int va = 0;
198
199 /*
200 * name:P prototype
201 * name:F global function

--- 43 unchanged lines hidden (view full) ---

245
246 return (iitype);
247}
248
249static iitype_t
250parse_sym(char *cp, iidesc_t *ii)
251{
252 tdesc_t *tdp;
253 iitype_t iitype;
254
255 /*
256 * name:G global variable
257 * name:S static variable
258 */
259 switch (*cp++) {
260 case 'G':
261 iitype = II_GVAR;

--- 771 unchanged lines hidden (view full) ---

1033 parse_debug(3, NULL, "enum %s: %s=%d", tdesc_name(*rtdp),
1034 elp->el_name, elp->el_number);
1035 prev = &elp->el_next;
1036 if (*cp++ != ',')
1037 expected("enumdef", ",", cp - 1);
1038 }
1039}
1040
1041tdesc_t *
1042lookup_name(tdesc_t **hash, const char *name)
1043{
1044 int bucket = compute_sum(name);
1045 tdesc_t *tdp, *ttdp = NULL;
1046
1047 for (tdp = hash[bucket]; tdp != NULL; tdp = tdp->t_next) {
1048 if (tdp->t_name != NULL && strcmp(tdp->t_name, name) == 0) {
1049 if (tdp->t_type == STRUCT || tdp->t_type == UNION ||
1050 tdp->t_type == ENUM || tdp->t_type == INTRINSIC)
1051 return (tdp);
1052 if (tdp->t_type == TYPEDEF)
1053 ttdp = tdp;
1054 }
1055 }
1056 return (ttdp);
1057}
1058
1059tdesc_t *
1060lookupname(const char *name)
1061{
1062 return (lookup_name(name_table, name));
1063}
1064
1065/*
1066 * Add a node to the hash queues.
1067 */
1068static void
1069addhash(tdesc_t *tdp, int num)
1070{

--- 75 unchanged lines hidden (view full) ---

1146 }
1147 }
1148 }
1149 printf("done\n");
1150}
1151
1152/*ARGSUSED1*/
1153static int
1154resolve_typed_bitfields_cb(mlist_t *ml, void *private)
1155{
1156 tdesc_t *tdp = ml->ml_type;
1157
1158 debug(3, "Resolving typed bitfields (member %s)\n",
1159 (ml->ml_name ? ml->ml_name : "(anon)"));
1160
1161 while (tdp) {
1162 switch (tdp->t_type) {
1163 case INTRINSIC:

--- 25 unchanged lines hidden (view full) ---

1189 /*NOTREACHED*/
1190 return (0);
1191}
1192
1193void
1194resolve_typed_bitfields(void)
1195{
1196 (void) list_iter(typedbitfldmems,
1197 (int (*)())resolve_typed_bitfields_cb, NULL);
1198}