diff mbox series

[Ada] Suppress warning for Interfaces.C with -fdump-ada-spec

Message ID 3300706.se7RloFIm5@polaris
State New
Headers show
Series [Ada] Suppress warning for Interfaces.C with -fdump-ada-spec | expand

Commit Message

Eric Botcazou May 12, 2020, 8:42 p.m. UTC
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.

Tested on x86-64/Linux, applied on the mainline.


2020-05-12  Eric Botcazou  <ebotcazou@adacore.com>

c-family/
	* c-ada-spec.c (dump_ads): Output pragma Warnings ("U"); on entry.
diff mbox series

Patch

diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 6d9192f2a26..c75b173eec3 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -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);