aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/gcc.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr97989-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr97989-2.c8
3 files changed, 17 insertions, 1 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bd4ad3b..1d32375 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1233,7 +1233,7 @@ static const char *cpp_unique_options =
%{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
- %{remap} %{g3|ggdb3|gstabs3|gxcoff3|gvms3:-dD}\
+ %{remap} %{%:debug-level-gt(2):-dD}\
%{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{E|M|MM:%W{o*}}";
diff --git a/gcc/testsuite/gcc.dg/cpp/pr97989-1.c b/gcc/testsuite/gcc.dg/cpp/pr97989-1.c
new file mode 100644
index 0000000..108dcba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr97989-1.c
@@ -0,0 +1,8 @@
+/* PR debug/97989 */
+/* { dg-do preprocess } */
+/* { dg-options "-g3 -g2 -P" } */
+
+#define foo bar
+int i;
+
+/* { dg-final { scan-file-not pr97989-1.i "(^|\\n)#define foo bar($|\\n)" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/pr97989-2.c b/gcc/testsuite/gcc.dg/cpp/pr97989-2.c
new file mode 100644
index 0000000..77a295a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr97989-2.c
@@ -0,0 +1,8 @@
+/* PR debug/97989 */
+/* { dg-do preprocess } */
+/* { dg-options "-g2 -g3 -P" } */
+
+#define foo bar
+int i;
+
+/* { dg-final { scan-file pr97989-2.i "(^|\\n)#define foo bar($|\\n)" } } */