This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] improve handling of unreferenced warning


Tested on i686-linux. Committed on mainline.

When a selected component involves an implicit dereference, expansion
introduces an explicit dereference that eventually indicates that the
prefix of the selected component is being read through the operation.
When expansion is disabled, the explicit dereference is not introduced,
and the special procedure Process_Implicit_Dereference_Prefix must be
used to generated the proper cross-reference information and prevent
spurious warnings.

The following procedure must compile quietly when all warnings are
enabled (-gnatwa):
--
procedure try is
   generic type item is private;
   package P is
      procedure what;
   private
      type node_type;
      type ptr is access all node_type;
      type node_type is record THing : item; left, right : ptr; end record;
   end P;
   package body P is
      procedure what is
        result : constant ptr := new node_type;
        this : ptr := result;
      begin
        loop
           if result /= null then
              this.left := null;
              if result.left = null then result.right := null; end if;
           end if;
        end loop;
      end what;
   end P;
begin null; end;

2005-03-08  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Analyze_Concatenation): Do not consider operators marked
	Eliminated as candidates for resolution. Both efficient, and avoids
	anomalies with operators declared in deleted code.
	(Process_Implicit_Dereference_Prefix): Use this procedure whenever
	expansion is disabled (as when compiling a generic) to prevent spurious
	warnings on prefixes of selected components.

Attachment: difs.26
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]