From e3371908b30b254f79f735abf66a8d17c188988a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 18 Dec 2019 09:51:14 +0000 Subject: trans.c (Pragma_to_gnu): Push a diagnostics state for pragma Warnings (Off) before turning off all the... * gcc-interface/trans.c (Pragma_to_gnu) : Push a diagnostics state for pragma Warnings (Off) before turning off all the warnings and only pop it for pragma Warnings (On). From-SVN: r279519 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/trans.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index aa37e62..bfc838f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-12-18 Eric Botcazou + + * gcc-interface/trans.c (Pragma_to_gnu) : Push a + diagnostics state for pragma Warnings (Off) before turning off all + the warnings and only pop it for pragma Warnings (On). + 2019-12-18 Justin Squirek * sem_ch6.adb (Analyze_Function_Return): Modify handling of diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index e6914cc..5f87bc3 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1975,7 +1975,21 @@ Pragma_to_gnu (Node_Id gnat_node) gnat_expr = Expression (Next (gnat_temp)); } else - gnat_expr = Empty; + { + gnat_expr = Empty; + + /* For pragma Warnings (Off), we save the current state... */ + if (kind == DK_IGNORED) + diagnostic_push_diagnostics (global_dc, location); + + /* ...so that, for pragma Warnings (On), we do not enable all + the warnings but just restore the previous state. */ + else + { + diagnostic_pop_diagnostics (global_dc, location); + break; + } + } imply = false; } -- cgit v1.1