aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/zconf.l
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /scripts/kconfig/zconf.l
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'scripts/kconfig/zconf.l')
-rw-r--r--scripts/kconfig/zconf.l40
1 files changed, 23 insertions, 17 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index d8f7236cb0a3..b22f884f9022 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -294,37 +294,45 @@ void zconf_initscan(const char *name)
294 294
295 current_file = file_lookup(name); 295 current_file = file_lookup(name);
296 current_file->lineno = 1; 296 current_file->lineno = 1;
297 current_file->flags = FILE_BUSY;
298} 297}
299 298
300void zconf_nextfile(const char *name) 299void zconf_nextfile(const char *name)
301{ 300{
301 struct file *iter;
302 struct file *file = file_lookup(name); 302 struct file *file = file_lookup(name);
303 struct buffer *buf = malloc(sizeof(*buf)); 303 struct buffer *buf = malloc(sizeof(*buf));
304 memset(buf, 0, sizeof(*buf)); 304 memset(buf, 0, sizeof(*buf));
305 305
306 current_buf->state = YY_CURRENT_BUFFER; 306 current_buf->state = YY_CURRENT_BUFFER;
307 yyin = zconf_fopen(name); 307 yyin = zconf_fopen(file->name);
308 if (!yyin) { 308 if (!yyin) {
309 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); 309 printf("%s:%d: can't open file \"%s\"\n",
310 zconf_curname(), zconf_lineno(), file->name);
310 exit(1); 311 exit(1);
311 } 312 }
312 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 313 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
313 buf->parent = current_buf; 314 buf->parent = current_buf;
314 current_buf = buf; 315 current_buf = buf;
315 316
316 if (file->flags & FILE_BUSY) { 317 for (iter = current_file->parent; iter; iter = iter->parent ) {
317 printf("%s:%d: do not source '%s' from itself\n", 318 if (!strcmp(current_file->name,iter->name) ) {
318 zconf_curname(), zconf_lineno(), name); 319 printf("%s:%d: recursive inclusion detected. "
319 exit(1); 320 "Inclusion path:\n current file : '%s'\n",
320 } 321 zconf_curname(), zconf_lineno(),
321 if (file->flags & FILE_SCANNED) { 322 zconf_curname());
322 printf("%s:%d: file '%s' is already sourced from '%s'\n", 323 iter = current_file->parent;
323 zconf_curname(), zconf_lineno(), name, 324 while (iter && \
324 file->parent->name); 325 strcmp(iter->name,current_file->name)) {
325 exit(1); 326 printf(" included from: '%s:%d'\n",
327 iter->name, iter->lineno-1);
328 iter = iter->parent;
329 }
330 if (iter)
331 printf(" included from: '%s:%d'\n",
332 iter->name, iter->lineno+1);
333 exit(1);
334 }
326 } 335 }
327 file->flags |= FILE_BUSY;
328 file->lineno = 1; 336 file->lineno = 1;
329 file->parent = current_file; 337 file->parent = current_file;
330 current_file = file; 338 current_file = file;
@@ -334,8 +342,6 @@ static void zconf_endfile(void)
334{ 342{
335 struct buffer *parent; 343 struct buffer *parent;
336 344
337 current_file->flags |= FILE_SCANNED;
338 current_file->flags &= ~FILE_BUSY;
339 current_file = current_file->parent; 345 current_file = current_file->parent;
340 346
341 parent = current_buf->parent; 347 parent = current_buf->parent;
@@ -353,7 +359,7 @@ int zconf_lineno(void)
353 return current_pos.lineno; 359 return current_pos.lineno;
354} 360}
355 361
356char *zconf_curname(void) 362const char *zconf_curname(void)
357{ 363{
358 return current_pos.file ? current_pos.file->name : "<none>"; 364 return current_pos.file ? current_pos.file->name : "<none>";
359} 365}