[committed] d: Increment gaggedWarnings if warning or deprecation message was suppressed

Message ID 20210406174543.1594001-1-ibuclaw@gdcproject.org
State New
Headers show
Series
  • [committed] d: Increment gaggedWarnings if warning or deprecation message was suppressed
Related show

Commit Message

Jason Merrill via Gcc-patches April 6, 2021, 5:45 p.m.
Hi,

This patch increments gaggedWarnings count if a warning or deprecation
message was suppressed.  Used by the front-end to catch potential errors
in code that is being compiled in a speculative context.

Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and
committed to mainline.

Regards,
Iain.

---
gcc/d/ChangeLog:

	* d-diagnostic.cc (vwarning): Increment gaggedWarnings if warning
	message	was suppressed.
	(vdeprecation): Likewise for deprecation messages.
---
 gcc/d/d-diagnostic.cc | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.27.0

Patch

diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc
index 659fae24459..3bf5a535edd 100644
--- a/gcc/d/d-diagnostic.cc
+++ b/gcc/d/d-diagnostic.cc
@@ -239,6 +239,8 @@  vwarning (const Loc &loc, const char *format, va_list ap)
 
       d_diagnostic_report_diagnostic (loc, 0, format, ap, DK_WARNING, false);
     }
+  else if (global.gag)
+    global.gaggedWarnings++;
 }
 
 /* Print supplementary message about the last warning with explicit location
@@ -297,6 +299,8 @@  vdeprecation (const Loc &loc, const char *format, va_list ap,
 				      DK_WARNING, false);
       free (xformat);
     }
+  else if (global.gag)
+    global.gaggedWarnings++;
 }
 
 /* Print supplementary message about the last deprecation with explicit