unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Julian Graham <joolean@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: scm_t_subr warnings
Date: Sun, 24 Feb 2013 16:00:49 -0500	[thread overview]
Message-ID: <CANdC_RB-df1nXZLzHy_FQGR+09Wasgs_Fp5m7qw10BC=PhTnSA@mail.gmail.com> (raw)

Hey Guilers,

Andy and Ludo and I were discussing this on IRC and it was suggested
that we move the question to the mailing list. I'm trying to compile
some code -- using `gcc -pedantic' -- that invokes `scm_c_make_gsubr',
and I'm getting the following warning:

  warning: ISO C forbids passing argument 5 of ‘scm_c_make_gsubr’
between function pointer and ‘void *’ [-pedantic]
  /usr/local/include/guile/2.0/libguile/gsubr.h:63:13: note: expected
‘scm_t_subr’ but argument is of type ‘struct scm_unused_struct *
(*)(struct scm_unused_struct *, struct scm_unused_struct *)’

I was confused, because I was sure that Guile defines scm_t_subr as
`SCM (*) ()', meaning that an `scm_t_subr' is of unspecified arity.
And I was right, but only at libguile compilation time. From __scm.h:

  #ifdef BUILDING_LIBGUILE
  typedef SCM (* scm_t_subr) ();
  #else
  typedef void *scm_t_subr;
  #endif

Thus the warning: ISO C lets you cast any kind of pointer to `void *'
-- except for a function pointer. Ludovic suggested that this bit of
preprocessor magic exists to support C++, in which the `()' style of
function prototyping is equivalent to `(void)'. But that leaves people
like me who want to be, well, pedantic, in a tough spot. Is there
anything we can do about this? One thing I was thinking was that we
could support the C++ case (and others) more explicitly. E.g.:

  #ifdef __cplusplus
  typedef void *scm_t_subr
  #else
  typedef SCM (* scm_t_subr) ();
  #endif

What do you think?


Regards,
Julian



             reply	other threads:[~2013-02-24 21:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 21:00 Julian Graham [this message]
2013-03-01  9:01 ` scm_t_subr warnings Ludovic Courtès

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to='CANdC_RB-df1nXZLzHy_FQGR+09Wasgs_Fp5m7qw10BC=PhTnSA@mail.gmail.com' \
    --to=joolean@gmail.com \
    --cc=guile-devel@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).