PP: Fix #1104: Missing check for #if overflow.

Also, rationalized this to generally make it safer and more readable.
It could use a more modern approach, at some point...
This commit is contained in:
John Kessenich 2017-10-16 15:29:07 -06:00
parent 1a4bbc4a95
commit 7d67c6cbc2
5 changed files with 164 additions and 17 deletions

View file

@ -309,7 +309,7 @@ protected:
bool endOfReplacementList() { return inputStack.empty() || inputStack.back()->endOfReplacementList(); }
bool isMacroInput() { return inputStack.size() > 0 && inputStack.back()->isMacroInput(); }
static const int maxIfNesting = 64;
static const int maxIfNesting = 65;
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth