caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Olivier Andrieu <andrieu@ijm.jussieu.fr>
To: damien.doligez@inria.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Question about warning message.
Date: Mon, 17 May 2004 17:31:37 +0200 (CEST)	[thread overview]
Message-ID: <20040517.173137.36610286.andrieu@ijm.jussieu.fr> (raw)
In-Reply-To: <81538EBA-A810-11D8-8794-00039310CAE8@inria.fr>

 Damien Doligez [Mon, 17 May 2004]:
 > > BTW, what about having a
 > >   (void) caml__dummy_##x;
 > >
 > > at the end of the CAMLxparam... macros?  This does shut up the warning,
 > > at least on gcc.
 > 
 > If we do that, the CAMLxparam macros can no longer be used in a
 > context of declarations.  These macros must include only definitions
 > because of the restrictive syntax of C.

I think that the OP meant to add that line in the (...) that is part of
the definition. Something like this:

#define CAMLxparam1(x) \
  struct caml__roots_block caml__roots_##x; \
  int caml__dummy_##x = ( \
    (caml__roots_##x.next = local_roots), \
    (local_roots = &caml__roots_##x), \
    (caml__roots_##x.nitems = 1), \
    (caml__roots_##x.ntables = 1), \
    (caml__roots_##x.tables [0] = &x), \
    (void) caml__dummy_##x, \
    0)

Amazingly, this seems to "work" as well (work = silence gcc) :

#define CAMLxparam1(x) \
  struct caml__roots_block caml__roots_##x; \
  int caml__dummy_##x = ( \
    (caml__roots_##x.next = local_roots), \
    (local_roots = &caml__roots_##x), \
    (caml__roots_##x.nitems = 1), \
    (caml__roots_##x.ntables = 1), \
    (caml__roots_##x.tables [0] = &x), \
    caml__dummy_##x)

-- 
   Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-05-17 15:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-05 15:16 Claudio Trento
2004-05-05 16:02 ` David Brown
2004-05-05 16:40   ` Roberto Bagnara
2004-05-17 14:43   ` Damien Doligez
2004-05-17 15:31     ` Olivier Andrieu [this message]
2004-05-17 16:44     ` Roberto Bagnara
2004-05-05 16:47 ` Xavier Leroy
2004-05-05 19:22   ` Shawn Wagner
2004-05-05 20:46 ` Evan Martin

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=20040517.173137.36610286.andrieu@ijm.jussieu.fr \
    --to=andrieu@ijm.jussieu.fr \
    --cc=caml-list@inria.fr \
    --cc=damien.doligez@inria.fr \
    /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 NNTP newsgroup(s).