From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: deprecated symbol warnings Date: Sat, 14 May 2005 13:40:42 +0100 Message-ID: <4285F1CA.5070602@ossau.uklinux.net> References: <41DEC762.765FDC9F@veritas.com> <41DED481.AEF0CABB@veritas.com> <170174E4-6347-11D9-9F67-000A95909EE2@raeburn.org> <5255fb95816d4cfc841223643e3481a8@raeburn.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1116077673 12664 80.91.229.2 (14 May 2005 13:34:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 May 2005 13:34:33 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat May 14 15:34:32 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DWwmX-0003Ww-Kt for guile-user@m.gmane.org; Sat, 14 May 2005 15:34:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWwo7-0004l5-GZ for guile-user@m.gmane.org; Sat, 14 May 2005 09:35:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DWwNK-0004nQ-5Y for guile-user@gnu.org; Sat, 14 May 2005 09:08:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DWwMU-0004Tj-Sz for guile-user@gnu.org; Sat, 14 May 2005 09:07:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWwIY-0002Rv-Bs for guile-user@gnu.org; Sat, 14 May 2005 09:03:18 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DWw4j-0000rQ-0Y for guile-user@gnu.org; Sat, 14 May 2005 08:49:01 -0400 Original-Received: from laruns (host81-130-142-214.in-addr.btopenworld.com [81.130.142.214]) by mail3.uklinux.net (Postfix) with ESMTP id AAC1C409FA3; Sat, 14 May 2005 12:41:38 +0000 (UTC) Original-Received: from [127.0.0.1] (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 386686F885; Sat, 14 May 2005 13:40:43 +0100 (BST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050420 Debian/1.7.7-2 X-Accept-Language: en Original-To: Ken Raeburn In-Reply-To: <5255fb95816d4cfc841223643e3481a8@raeburn.org> X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:4494 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:4494 Ken Raeburn wrote: > > Well, I've got a rough version up and limping, that does both > compile-time and link-time warnings: This looks very useful. I'm not an expert in this kind of thing, but here are some comments. > % make depr > gcc -I/var/raeburn/guile/guile-afs/Install/include -g -c -o depr.o > depr.c > depr.c: In function `main': > depr.c:6: warning: `SCM_ICDR' is deprecated (declared at > /var/raeburn/guile/guile-afs/Install/include/libguile/deprecated.h:54) > gcc -o depr depr.o -L/var/raeburn/guile/guile-afs/Install/lib -lguile > depr.o(.text+0x15): In function `main': > /var/raeburn/guile/guile-afs/test/depr.c:6: SCM_ICDR is deprecated, > please don't use it Nice output. > (No warning is printed at run time.) Yes, that makes sense. > The warnings can be disabled while building guile (only while building > deprecated.c, I hope) so that -Werror doesn't kill the build. > > In the header files, here's how it's taking shape, roughly: > > #if defined(SCM_DISABLE_DEPRECATION_WARNINGS) > # define SCM_DECL_DEPRECATED /* empty */ > #elif __GNUC__ >= 3 > # define SCM_DECL_DEPRECATED __attribute__((deprecated)) > #elif defined _WIN32 Does the __declspec syntax work for all Windows compilers? If it's actually specific to MSVC (which is the only compiler I'm familiar with), you should use _MSC_VER. If it's for all Windows compilers, I'm surprised by the underscore - i.e. I'd normally use WIN32; are WIN32 and _WIN32 equivalent? > /* TBD: How many old versions of the compiler support this? > Will older ones complain, or ignore it? */ > # define SCM_DECL_DEPRECATED __declspec(deprecated) /* UNTESTED */ > #else > # define SCM_DECL_DEPRECATED /* empty, no compile-time warnings */ > #endif > > > /* N.B.: Application code will sometimes test whether one of these > macros is defined, to figure out if the version of Guile in use > predates the creation of the macro. So at deprecation time, we > still want the macro to be visible. ANSI C says "#define foo foo" > is okay, but if we get complaints about it, try switching the > non-macro name to "foo_" or "foo_deprecated" or something; make it > a simple concatenation so that we can make the other macros > continue to be simple. */ I think we should assume in advance that we'll hit trouble with this on some platforms. Otherwise it's just another hiccup to push people away from trying Guile out. > > /* From eval.h: Macros for handling ilocs. These were deprecated in > guile > * 1.7.0 on 2004-04-22. */ > extern SCM_DECL_DEPRECATED scm_t_bits SCM_IFRINC; > extern SCM_DECL_DEPRECATED scm_t_bits SCM_ICDR; > #define SCM_IFRINC SCM_IFRINC > #define SCM_ICDR SCM_ICDR > > extern SCM_DECL_DEPRECATED long SCM_IFRAME(SCM n); > #define SCM_IFRAME SCM_IFRAME Nice. Slight extra overhead, but well worth it IMO for the extra function. > The link-time warnings are a bit messier. What is the extra benefit of link-time warnings over compile-time? Are there any cases where the user will see a link-time warning without a corresponding compile-time one? Would link-time warnings show up when linking against a 3rd party library that chose to use deprecated symbols? > scm_c_issue_deprecation_warning (though I don't know if I need to worry > about i18n interactions there). I don't believe it's yet been suggested that we would translate the Scheme names of primitives, so I doubt there would be a problem here. (Out of interest, do any other scripting languages do this?) Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user