unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: deprecated symbol warnings
Date: Sat, 14 May 2005 13:40:42 +0100	[thread overview]
Message-ID: <4285F1CA.5070602@ossau.uklinux.net> (raw)
In-Reply-To: <5255fb95816d4cfc841223643e3481a8@raeburn.org>

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


  reply	other threads:[~2005-05-14 12:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1CmxC0-0003DB-Gx@sc8-sf-web1.sourceforge.net>
2005-01-07 17:31 ` SCM_LENGTH ??? Bruce Korb
2005-01-07 18:07   ` Marius Vollmer
2005-01-07 18:27     ` Bruce Korb
2005-01-10 17:26       ` Marius Vollmer
2005-01-10 18:03         ` Bruce Korb
2005-01-10 20:59           ` Greg Troxel
2005-01-11 18:08           ` Marius Vollmer
2005-01-11 23:40             ` Kevin Ryde
2005-01-12 10:33               ` Marius Vollmer
2005-01-10 20:34         ` Ken Raeburn
2005-01-11 16:12           ` Bruce Korb
2005-01-11 18:32           ` Marius Vollmer
2005-05-14  2:52           ` deprecated symbol warnings Ken Raeburn
2005-05-14 12:40             ` Neil Jerram [this message]
2005-05-14 18:48               ` Ken Raeburn
2005-05-15  3:17                 ` John W. Eaton
2005-05-15 10:19                   ` Neil Jerram
2005-05-16  5:52                   ` Ken Raeburn
2005-05-18  4:22                     ` tomas
2005-05-18 12:20                     ` Ludovic Courtès
2005-05-18 17:17                       ` automated testing (was Re: deprecated symbol warnings) Ken Raeburn
2005-05-26 18:58                 ` deprecated symbol warnings Neil Jerram
2005-05-28 21:55                   ` Ken Raeburn
2005-05-18 19:18               ` deprecated symbol warnings and Windows Ken Raeburn

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4285F1CA.5070602@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).