Prevent stack overflow in macro expansion

Add a configurable limit for how many nested MacroExpander objects can
be created in the preprocessor, so that stack overflow can be
prevented in case of malicious shaders. By default the limit is set to
1000. In unit tests the limit is set lower to make the test run
faster.

Includes refactoring of most of the preprocessor tests so that they
use utility functions provided by the test class instead of repeating
the same code for initializing the preprocessor.

BUG=angleproject:1600
TEST=angle_unittests

Change-Id: I23b5140d9f2dc52df96111650db63150f7238494
Reviewed-on: https://chromium-review.googlesource.com/413986
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/preprocessor/DiagnosticsBase.cpp b/src/compiler/preprocessor/DiagnosticsBase.cpp
index fcb24e4..2b5e57c 100644
--- a/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -82,6 +82,8 @@
         return "Too many arguments for macro";
       case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
         return "duplicate macro parameter name";
+      case PP_MACRO_INVOCATION_CHAIN_TOO_DEEP:
+          return "macro invocation chain too deep";
       case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
         return "unexpected #endif found without a matching #if";
       case PP_CONDITIONAL_ELSE_WITHOUT_IF: