From 934a54180541d27139aecbd19e7f50cb73552c7c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 1 Dec 2020 09:39:04 +0100 Subject: driver: Don't imply -dD for -g3 -g0 [PR97989] The driver enables -dD when preprocessing when -g3 is specified, for obvious reasons that we need the macros to be preserved somewhere for them to make up the debug info. But it enables it even if -g3 is later overridden to -g2, -g1 or -g0, where we in the end don't emit .debug_mac{ros,info}. The following patch passes -dD only if we'll need it. 2020-12-01 Jakub Jelinek PR debug/97989 * gcc.c (cpp_unique_options): Add -dD if %:debug-level-gt(2) rather than g3|ggdb3|gstabs3|gxcoff3|gvms3. * gcc.dg/cpp/pr97989-1.c: New test. * gcc.dg/cpp/pr97989-2.c: New test. --- gcc/gcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gcc.c') 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*}}"; -- cgit v1.1