X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=token.c;h=77fec1efbeac0071594df0dbd22de787d8b02dd8;hp=7bba1993fd815aa13befd0c80228063fcd07e0eb;hb=e968236d060c7dbae1647d5f54b27d4070b63b06;hpb=bf97c76e7e6a87b0495cb037b094b6d8b5027a40 diff --git a/token.c b/token.c index 7bba199..77fec1e 100644 --- a/token.c +++ b/token.c @@ -730,18 +730,26 @@ int fpop(void) { // Pop IFENT levels until we reach the conditional assembly context we // were at when the input object was entered. + int numUnmatched = 0; + while (ifent != inobj->in_ifent) { - if (d_endif() != 0) // Something bad happened during endif parsing? - return -1; // If yes, bail instead of getting stuck in a loop + if (d_endif() != 0) // Something bad happened during endif parsing? + return -1; // If yes, bail instead of getting stuck in a loop + + numUnmatched++; } - tok = inobj->in_otok; // Restore tok and otok + // Give a warning to the user that we had to wipe their bum for them + if (numUnmatched > 0) + warni("missing %d .endif(s)", numUnmatched); + + tok = inobj->in_otok; // Restore tok and otok etok = inobj->in_etok; switch (inobj->in_type) { - case SRC_IFILE: // Pop and release an IFILE + case SRC_IFILE: // Pop and release an IFILE if (debug) printf("[Leaving: %s]\n", curfname); @@ -912,7 +920,7 @@ retry: if ((ln = GetNextLine()) == NULL) { if (debug) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); - if (fpop()==0) // Pop input level + if (fpop() == 0) // Pop input level goto retry; // Try for more lines else {