From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA03353; Mon, 17 May 2004 17:31:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA03342 for ; Mon, 17 May 2004 17:31:46 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4HFVjSH019791; Mon, 17 May 2004 17:31:45 +0200 Received: from localhost (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i4HFVjKc088311 ; Mon, 17 May 2004 17:31:45 +0200 (CEST) X-Ids: 168 Date: Mon, 17 May 2004 17:31:37 +0200 (CEST) Message-Id: <20040517.173137.36610286.andrieu@ijm.jussieu.fr> To: damien.doligez@inria.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Question about warning message. From: Olivier Andrieu In-Reply-To: <81538EBA-A810-11D8-8794-00039310CAE8@inria.fr> References: <20040505160230.GA26320@davidb.org> <81538EBA-A810-11D8-8794-00039310CAE8@inria.fr> X-Mailer: Mew version 4.0.64 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40A8DAE1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 40A8DAE1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 andrieu:01 andrieu:01 damien:01 2004:99 gcc:01 struct:01 nitems:01 gcc:01 struct:01 nitems:01 dummy:01 dummy:01 caml:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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