aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-12-18 09:51:14 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-12-18 09:51:14 +0000
commite3371908b30b254f79f735abf66a8d17c188988a (patch)
treef3a8d751e055aaec4d0e6e9be6f90ecc73b67dc4 /gcc/ada
parentd4a45898bc44a87f076485da44912df8c461bc64 (diff)
downloadgcc-e3371908b30b254f79f735abf66a8d17c188988a.zip
gcc-e3371908b30b254f79f735abf66a8d17c188988a.tar.gz
gcc-e3371908b30b254f79f735abf66a8d17c188988a.tar.bz2
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) <Pragma_Warnings>: 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
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/trans.c16
2 files changed, 21 insertions, 1 deletions
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 <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Pragma_to_gnu) <Pragma_Warnings>: 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 <squirek@adacore.com>
* 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;
}