Suppress warning for Interfaces.C with -fdump-ada-spec
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 12 May 2020 20:41:09 +0000 (22:41 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 12 May 2020 20:42:17 +0000 (22:42 +0200)
The C/C++ bindings generated by means of -fdump-ada-spec always contain
with and use clauses for Interfaces.C, but they can be unused in some
cases so make sure to avoid warning about that.

* c-ada-spec.c (dump_ads): Output pragma Warnings ("U"); on entry.

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c

index 0550e53..0be10ad 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-12  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (dump_ads): Output pragma Warnings ("U"); on entry.
+
 2020-05-08  Nathan Sidwell  <nathan@acm.org>
 
        Reimplement directives only processing.
index 6d9192f..c75b173 100644 (file)
@@ -3412,9 +3412,12 @@ dump_ads (const char *source_file,
       cpp_check = check;
       dump_ada_nodes (&pp, source_file);
 
-      /* We require Ada 2012 syntax, so generate corresponding pragma.
-         Also, disable style checks since this file is auto-generated.  */
-      fprintf (f, "pragma Ada_2012;\npragma Style_Checks (Off);\n\n");
+      /* We require Ada 2012 syntax, so generate corresponding pragma.  */
+      fputs ("pragma Ada_2012;\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);
 
       /* Dump withs.  */
       dump_ada_withs (f);