* [Ada] Do not give warnings for compiler-generated entities by default
@ 2022-05-19 14:16 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-19 14:16 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
The rationale is that these entities are almost always the result of
expansion activities in the front-end, over which the user has very
limited control. These warnings can be restored by means of -gnatD.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* gcc-interface/utils.cc (gnat_pushdecl): Also set TREE_NO_WARNING
on the decl if Comes_From_Source is false for the associated node.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 732 bytes --]
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -852,8 +852,11 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
if (!deferred_decl_context)
DECL_CONTEXT (decl) = context;
- suppress_warning (decl, all_warnings,
- No (gnat_node) || Warnings_Off (gnat_node));
+ /* Disable warnings for compiler-generated entities or explicit request. */
+ if (No (gnat_node)
+ || !Comes_From_Source (gnat_node)
+ || Warnings_Off (gnat_node))
+ suppress_warning (decl);
/* Set the location of DECL and emit a declaration for it. */
if (Present (gnat_node) && !renaming_from_instantiation_p (gnat_node))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-19 14:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 14:16 [Ada] Do not give warnings for compiler-generated entities by default Pierre-Marie de Rodat
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).