aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2019-07-02 20:23:30 +0000
committerQing Zhao <qinzhao@gcc.gnu.org>2019-07-02 20:23:30 +0000
commit1c6ffbab63f55187909b6d71cfca6080e9cf43cf (patch)
tree679d86bed67edce3cb9d5cbc6390c7cbaa52e899 /libcpp/directives.c
parent709877bf765cbef2d758ecb48c6e34b94e8a7151 (diff)
downloadgcc-1c6ffbab63f55187909b6d71cfca6080e9cf43cf.zip
gcc-1c6ffbab63f55187909b6d71cfca6080e9cf43cf.tar.gz
gcc-1c6ffbab63f55187909b6d71cfca6080e9cf43cf.tar.bz2
re PR preprocessor/90581 (provide an option to adjust the maximum depth of nested #include)
PR preprocessor/90581 Add a cpp option -fmax-include-depth to set the maximum depth of the nested #include. From-SVN: r272948
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 3ee8bc4..2fdfaf0 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -831,8 +831,13 @@ do_include_common (cpp_reader *pfile, enum include_type type)
}
/* Prevent #include recursion. */
- if (pfile->line_table->depth >= CPP_STACK_MAX)
- cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");
+ if (pfile->line_table->depth >= CPP_OPTION (pfile, max_include_depth))
+ cpp_error (pfile,
+ CPP_DL_ERROR,
+ "#include nested depth %u exceeds maximum of %u"
+ " (use -fmax-include-depth=DEPTH to increase the maximum)",
+ pfile->line_table->depth,
+ CPP_OPTION (pfile, max_include_depth));
else
{
/* Get out of macro context, if we are. */