From owner-freebsd-java Thu May 17 5:43:40 2001 Delivered-To: freebsd-java@freebsd.org Received: from core.inf.ethz.ch (core.inf.ethz.ch [129.132.178.196]) by hub.freebsd.org (Postfix) with ESMTP id 5377737B424 for ; Thu, 17 May 2001 05:43:30 -0700 (PDT) (envelope-from cartho@silmaril.org) Received: from lillian-ics.inf.ethz.ch (root@lillian-ics.inf.ethz.ch [129.132.134.2]) by core.inf.ethz.ch (8.9.3/8.9.3) with ESMTP id OAA28255; Thu, 17 May 2001 14:43:25 +0200 (MET DST) Received: from silmaril.org (babylon8.inf.ethz.ch [129.132.134.131]) by lillian-ics.inf.ethz.ch (8.9.3/8.9.3) with ESMTP id OAA04211; Thu, 17 May 2001 14:43:27 +0200 (MET DST) Message-ID: <3B03C76E.C6EC9496@silmaril.org> Date: Thu, 17 May 2001 14:43:26 +0200 From: Cyrille Artho Organization: ETH Zurich X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.19pre17 i686) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-java@freebsd.org Cc: Ernst de Haan Subject: First FreeBSD port of Jlint Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, Ernst de Haan has tried to compile my Jlint Java program checker, http://artho.com/jlint/ under FreeBSD. The compilation failed due to va_arg macro problems. Jlint is a Java class file checker that finds NULL pointer, array bound, multi-threading and other problems at compile-time. I have now made a provisional patch for Jlint, such that it should compile under FreeBSD as well. I would be glad if someone could try it under BSD versions other than FreeBSD 4.3, and see if it compiles. The patch is very short and attached below: --- /tmp/jlint/jlint.cc Fri Mar 16 22:03:51 2001 +++ /home/cartho/jlint/jlint.cc Thu May 17 12:40:19 2001 @@ -13,6 +13,15 @@ #include #include #include +// FreeBSD 4.3 and lower fix +#if defined(__FreeBSD__) +#define VA_ARG(ap, type) \ + (*(type *)((ap) = (type *)((char *)ap + __va_size(type)), \ + (type *)(((char *)ap) - __va_size(type)))) +#else +#define VA_ARG va_arg +#endif + #include #ifdef _WIN32 #include @@ -138,7 +146,7 @@ int n_parameters = 2; if (code == msg_loop || code == msg_sync_loop) { // extract loop identifier - parameter[n_parameters++] = va_arg(ap, void*); + parameter[n_parameters++] = VA_ARG(ap, void*); } if (history != NULL) { if (compound_message != NULL @@ -198,7 +206,7 @@ assert(n == 1); assert(index < MAX_MSG_PARAMETERS); while (index >= n_parameters) { - parameter[n_parameters++] = va_arg(ap, void*); + parameter[n_parameters++] = VA_ARG(ap, void*); } src += pos; char* save_dst = dst; -- Regards, Cyrille Artho - http://artho.com/ - Tel. +41 - [0]1 - 632 09 88 If you go on with this nuclear arms race, all you are going to do is make the rubble bounce. -- Winston Churchill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message