aboutsummaryrefslogtreecommitdiff
path: root/gcc
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 /gcc
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 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-opts.c4
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/doc/cppopts.texi4
-rw-r--r--gcc/doc/invoke.texi1
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1a.h1
-rw-r--r--gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1b.h1
-rw-r--r--gcc/testsuite/c-c++-common/cpp/fmax-include-depth.c4
10 files changed, 38 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f40d55e..62b126f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-02 qing zhao <qing.zhao@oracle.com>
+
+ PR preprocessor/90581
+ * doc/cppopts.texi: Add document for -fmax-include-depth.
+ * doc/invoke.texi (Preprocessor Options): List -fmax-include-depth.
+
2019-07-02 Uroš Bizjak <ubizjak@gmail.com>
* config/i386/mmx.md (mmx_pack<s_trunsuffix>swb):
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 22d7c6e..e56bd7a 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-02 qing zhao <qing.zhao@oracle.com>
+
+ PR preprocessor/90581
+ * c-opts.c (c_common_handle_option): Handle -fmax-include-depth.
+ * c.opt: Add new option -fmax-include-depth.
+
2019-06-26 Jason Merrill <jason@redhat.com>
PR c++/55442 - memory-hog with highly recursive constexpr.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 954b6a4..188da43 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -460,6 +460,10 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
cpp_opts->extended_identifiers = value;
break;
+ case OPT_fmax_include_depth_:
+ cpp_opts->max_include_depth = value;
+ break;
+
case OPT_foperator_names:
cpp_opts->operator_names = value;
break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 080066fa..4c8b002 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1575,6 +1575,10 @@ flax-vector-conversions
C ObjC C++ ObjC++ Var(flag_lax_vector_conversions)
Allow implicit conversions between vectors with differing numbers of subparts and/or differing element types.
+fmax-include-depth=
+C ObjC C++ ObjC++ Joined RejectNegative UInteger
+fmax-include-depth=<number> Set the maximum depth of the nested #include.
+
fms-extensions
C ObjC C++ ObjC++ Var(flag_ms_extensions)
Don't warn about uses of Microsoft extensions.
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index 48c574f..61e22cd 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -261,6 +261,10 @@ enabled by default for C99 (and later C standard versions) and C++.
@opindex fno-canonical-system-headers
When preprocessing, do not shorten system header paths with canonicalization.
+@item -fmax-include-depth=@var{depth}
+@opindex fmax-include-depth
+Set the maximum depth of the nested #include. The default is 200.
+
@item -ftabstop=@var{width}
@opindex ftabstop
Set the distance between tab stops. This helps the preprocessor report
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9c6050b..ae1a7d2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -518,6 +518,7 @@ Objective-C and Objective-C++ Dialects}.
-fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
-fexec-charset=@var{charset} -fextended-identifiers @gol
-finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
+-fmax-include-depth=@var{depth} @gol
-fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
-fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
-fwide-exec-charset=@var{charset} -fworking-directory @gol
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 423e075..55deef7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2019-07-02 qing zhao <qing.zhao@oracle.com>
+
+ PR preprocessor/90581
+ * c-c++-common/cpp/fmax-include-depth-1a.h: New test.
+ * c-c++-common/cpp/fmax-include-depth-1b.h: New test.
+ * c-c++-common/cpp/fmax-include-depth.c: New test.
+
2019-07-02 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/alias-access-path-7.c: New testcase.
diff --git a/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1a.h b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1a.h
new file mode 100644
index 0000000..4e610c0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1a.h
@@ -0,0 +1 @@
+int a;
diff --git a/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1b.h b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1b.h
new file mode 100644
index 0000000..c167587
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth-1b.h
@@ -0,0 +1 @@
+#include "fmax-include-depth-1a.h"
diff --git a/gcc/testsuite/c-c++-common/cpp/fmax-include-depth.c b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth.c
new file mode 100644
index 0000000..bd8cc3a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/fmax-include-depth.c
@@ -0,0 +1,4 @@
+/* { dg-do preprocess} */
+/* { dg-options "-fmax-include-depth=1" } */
+
+#include "fmax-include-depth-1b.h" /* { dg-error ".include nested depth 1 exceeds maximum of 1 .use -fmax-include-depth=DEPTH to increase the maximum." } */