public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3326] Improve compatibility of -fdump-ada-spec with warnings
@ 2021-09-03  9:20 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2021-09-03  9:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8d34ffb4e8ed5300d0276b55f573add6db2517e8

commit r12-3326-g8d34ffb4e8ed5300d0276b55f573add6db2517e8
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Sep 3 11:18:01 2021 +0200

    Improve compatibility of -fdump-ada-spec with warnings
    
    This makes sure that the style and warning settings used in the
    C/C++ bindings generated by -fdump-ada-spec do not leak into the
    units that use them.
    
    gcc/c-family/
            * c-ada-spec.c (dump_ads): Generate pragmas to disable style checks
            and -gnatwu warning for the package specification.

Diff:
---
 gcc/c-family/c-ada-spec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 827bcc76830..b197d551c43 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -3440,11 +3440,12 @@ dump_ads (const char *source_file,
       dump_ada_nodes (&pp, source_file);
 
       /* We require Ada 2012 syntax, so generate corresponding pragma.  */
-      fputs ("pragma Ada_2012;\n", f);
+      fputs ("pragma Ada_2012;\n\n", f);
 
       /* Disable style checks and warnings on unused entities since this file
 	 is auto-generated and always has a with clause for Interfaces.C.  */
-      fputs ("pragma Style_Checks (Off);\npragma Warnings (\"U\");\n\n", f);
+      fputs ("pragma Style_Checks (Off);\n", f);
+      fputs ("pragma Warnings (Off, \"-gnatwu\");\n\n", f);
 
       /* Dump withs.  */
       dump_ada_withs (f);
@@ -3452,7 +3453,10 @@ dump_ads (const char *source_file,
       fprintf (f, "\npackage %s is\n\n", pkg_name);
       pp_write_text_to_stream (&pp);
       /* ??? need to free pp */
-      fprintf (f, "end %s;\n", pkg_name);
+      fprintf (f, "end %s;\n\n", pkg_name);
+
+      fputs ("pragma Style_Checks (On);\n", f);
+      fputs ("pragma Warnings (On, \"-gnatwu\");\n", f);
       fclose (f);
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-03  9:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  9:20 [gcc r12-3326] Improve compatibility of -fdump-ada-spec with warnings Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).