public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "oliver dot kellogg at sysde dot eads dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/14195] New: Suggestion for System.OS_Interface.struct_sigaction
Date: Wed, 18 Feb 2004 16:31:00 -0000	[thread overview]
Message-ID: <20040218163116.14195.oliver.kellogg@sysde.eads.net> (raw)

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


             reply	other threads:[~2004-02-18 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-18 16:31 oliver dot kellogg at sysde dot eads dot net [this message]
2004-02-18 16:59 ` [Bug ada/14195] " charlet at gcc dot gnu dot org
2004-02-20 11:27 ` oliver dot kellogg at sysde dot eads dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040218163116.14195.oliver.kellogg@sysde.eads.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).