From: Eric Botcazou Date: Wed, 23 Mar 2022 13:46:28 +0000 (+0100) Subject: [Ada] Do not give warnings for compiler-generated entities by default X-Git-Tag: basepoints/gcc-14~6540 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4c84b82c5f903de6911157281a837481bca780e;p=thirdparty%2Fgcc.git [Ada] Do not give warnings for compiler-generated entities by default 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. 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. --- diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index d747c639a8f..c583acaf967 100644 --- 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))