| 63 | } |
| 64 | |
| 65 | void process(Tokenrow* trp) |
| 66 | { |
| 67 | int anymacros = 0; |
| 68 | |
| 69 | for (;;) |
| 70 | { |
| 71 | if (trp->tp >= trp->lp) |
| 72 | { |
| 73 | trp->tp = trp->lp = trp->bp; |
| 74 | outptr = outbuf; |
| 75 | // coverity[overrun-buffer-arg: FALSE] - a multiple of trp->max is allocated, not trp->max itself |
| 76 | anymacros |= gettokens(trp, 1); |
| 77 | trp->tp = trp->bp; |
| 78 | } |
| 79 | if (trp->tp->type == END) |
| 80 | { |
| 81 | if (--incdepth >= 0) |
| 82 | { |
| 83 | if (cursource->ifdepth) |
| 84 | error(ERROR, "Unterminated conditional in #include"); |
| 85 | unsetsource(); |
| 86 | cursource->line += cursource->lineinc; |
| 87 | trp->tp = trp->lp; |
| 88 | if (!Pflag) |
| 89 | genline(); |
| 90 | continue; |
| 91 | } |
| 92 | if (ifdepth) |
| 93 | error(ERROR, "Unterminated #if/#ifdef/#ifndef"); |
| 94 | break; |
| 95 | } |
| 96 | if (trp->tp->type == SHARP) |
| 97 | { |
| 98 | trp->tp += 1; |
| 99 | control(trp); |
| 100 | } |
| 101 | else if (!skipping && anymacros) |
| 102 | expandrow(trp, NULL); |
| 103 | if (skipping) |
| 104 | setempty(trp); |
| 105 | puttokens(trp); |
| 106 | anymacros = 0; |
| 107 | cursource->line += cursource->lineinc; |
| 108 | if (cursource->lineinc > 1 && !Pflag) |
| 109 | genline(); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | void control(Tokenrow* trp) |
| 114 | { |