Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Question about warning message.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] Question about warning message.
 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