[Bug ada/14195] New: Suggestion for System.OS_Interface.struct_sigaction

oliver dot kellogg at sysde dot eads dot net gcc-bugzilla@gcc.gnu.org
Wed Feb 18 16:31:00 GMT 2004


This is a wish, not a bug.
It applies to all recent versions of GNAT up to and including GNU
CVS mainline of 2004/02/18.

The type struct_sigaction in package System.OS_Interface is
defined as follows:

   type struct_sigaction is record
      sa_handler : System.Address;
      sa_mask    : sigset_t;
      sa_flags   : int;
   end record;
   pragma Convention (C, struct_sigaction);

I suggest making the sa_mask component aliased, i.e.

      sa_mask    : aliased sigset_t;

Reason: The common use case is to create a sigset_t using the

   function sigemptyset (set : access sigset_t) return int;

or other function from the same package.
If the sa_mask component in struct_sigaction is made aliased
then the usage is simplified:

   declare
      sa : struct_sigaction;
      retval : int := sigemptyset (sa.sa_mask'access);
   begin
      ...
   end;

Without the aliasing, it is necessary to use a separate
temporary variable for the sigset_t:

   declare
      temp_sigset : aliased sigset_t;
      sa : struct_sigaction;
      retval : int := sigemptyset (temp_sigset'access);
   begin
      sa.sa_mask := temp_sigset;
   end;


Thanks.

-- 
           Summary: Suggestion for System.OS_Interface.struct_sigaction
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oliver dot kellogg at sysde dot eads dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: -
  GCC host triplet: -
GCC target triplet: i386-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14195



More information about the Gcc-bugs mailing list