diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-12-18 09:51:14 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-12-18 09:51:14 +0000 |
commit | e3371908b30b254f79f735abf66a8d17c188988a (patch) | |
tree | f3a8d751e055aaec4d0e6e9be6f90ecc73b67dc4 /gcc/ada | |
parent | d4a45898bc44a87f076485da44912df8c461bc64 (diff) | |
download | gcc-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/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 16 |
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; } |