From 11dd3be56b83d11465ae5d6ecd0d8096531678e5 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 12 May 2020 22:41:09 +0200 Subject: [PATCH] Suppress warning for Interfaces.C with -fdump-ada-spec 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 | 4 ++++ gcc/c-family/c-ada-spec.c | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 0550e534942..0be10ad7618 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2020-05-12 Eric Botcazou + + * c-ada-spec.c (dump_ads): Output pragma Warnings ("U"); on entry. + 2020-05-08 Nathan Sidwell Reimplement directives only processing. 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); -- 2.30.2