From b630da34246d599b46a8ab849bde7639556bf5be Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 10 Aug 1987 10:43:51 +0000 Subject: [PATCH] nestlevel count per file --- util/cpp/domacro.c | 2 +- util/cpp/file_info.h | 2 ++ util/cpp/input.c | 1 - util/cpp/main.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/util/cpp/domacro.c b/util/cpp/domacro.c index 6ef927a4a..d58706be5 100644 --- a/util/cpp/domacro.c +++ b/util/cpp/domacro.c @@ -30,7 +30,6 @@ IMPORT char *getwdir(); PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */ /* 1 if a corresponding ELSE has been */ /* encountered. */ -int nestlevel = -1; /* initially no nesting level. */ PRIVATE char * GetIdentifier() @@ -263,6 +262,7 @@ do_include() } else { WorkingDir = getwdir(result); + nestlevel = -1; FileName = result; LineNumber = 1; } diff --git a/util/cpp/file_info.h b/util/cpp/file_info.h index 241c8de6b..cc6c663ce 100644 --- a/util/cpp/file_info.h +++ b/util/cpp/file_info.h @@ -9,10 +9,12 @@ struct file_info { unsigned int fil_lino; char *fil_name; char *fil_wdir; + int fil_nestlevel; }; #define LineNumber finfo.fil_lino #define FileName finfo.fil_name #define WorkingDir finfo.fil_wdir +#define nestlevel finfo.fil_nestlevel extern struct file_info finfo; /* input.c */ diff --git a/util/cpp/input.c b/util/cpp/input.c index 0e78ca0ab..78aca5b6a 100644 --- a/util/cpp/input.c +++ b/util/cpp/input.c @@ -47,7 +47,6 @@ AtEoIT() AtEoIF() { - extern int nestlevel; if (nestlevel != -1) warning("missing #endif"); else if (NoUnstack) warning("unexpected EOF"); diff --git a/util/cpp/main.c b/util/cpp/main.c index cb927ef53..11c1edc54 100644 --- a/util/cpp/main.c +++ b/util/cpp/main.c @@ -77,5 +77,6 @@ compile(argc, argv) fatal("%s: no source file %s\n", prog_name, source ? source : "stdin"); if (source) WorkingDir = getwdir(dummy); + nestlevel = -1; preprocess(source); } -- 2.34.1