~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to scripts/kconfig/zconf.l

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
 
295
295
        current_file = file_lookup(name);
296
296
        current_file->lineno = 1;
297
 
        current_file->flags = FILE_BUSY;
298
297
}
299
298
 
300
299
void zconf_nextfile(const char *name)
301
300
{
 
301
        struct file *iter;
302
302
        struct file *file = file_lookup(name);
303
303
        struct buffer *buf = malloc(sizeof(*buf));
304
304
        memset(buf, 0, sizeof(*buf));
314
314
        buf->parent = current_buf;
315
315
        current_buf = buf;
316
316
 
317
 
        if (file->flags & FILE_BUSY) {
318
 
                printf("%s:%d: do not source '%s' from itself\n",
319
 
                       zconf_curname(), zconf_lineno(), name);
320
 
                exit(1);
321
 
        }
322
 
        if (file->flags & FILE_SCANNED) {
323
 
                printf("%s:%d: file '%s' is already sourced from '%s'\n",
324
 
                       zconf_curname(), zconf_lineno(), name,
325
 
                       file->parent->name);
326
 
                exit(1);
327
 
        }
328
 
        file->flags |= FILE_BUSY;
 
317
        for (iter = current_file->parent; iter; iter = iter->parent ) {
 
318
                if (!strcmp(current_file->name,iter->name) ) {
 
319
                        printf("%s:%d: recursive inclusion detected. "
 
320
                               "Inclusion path:\n  current file : '%s'\n",
 
321
                               zconf_curname(), zconf_lineno(),
 
322
                               zconf_curname());
 
323
                        iter = current_file->parent;
 
324
                        while (iter && \
 
325
                               strcmp(iter->name,current_file->name)) {
 
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
                }
 
335
        }
329
336
        file->lineno = 1;
330
337
        file->parent = current_file;
331
338
        current_file = file;
335
342
{
336
343
        struct buffer *parent;
337
344
 
338
 
        current_file->flags |= FILE_SCANNED;
339
 
        current_file->flags &= ~FILE_BUSY;
340
345
        current_file = current_file->parent;
341
346
 
342
347
        parent = current_buf->parent;