From: Marius Vollmer <mvo@zagadka.de>
Cc: guile-devel@gnu.org
Subject: Re: [Patch] inline.h should not define inline functions with "extern" linkage
Date: Fri, 12 Sep 2003 16:13:37 +0200 [thread overview]
Message-ID: <87vfryqelq.fsf@zagadka.ping.de> (raw)
In-Reply-To: <uw5y8zyw7pw.fsf@saturn.math.uni-magdeburg.de> (Matthias Koeppe's message of "Thu, 19 Jun 2003 14:51:55 +0200")
Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> writes:
> I am now building Guile from CVS HEAD with a version of the Sun Forte
> C compiler that supports the "inline" keyword.
>
> The "inline" keyword does not imply static linkage, and in fact
> inline.h defines the functions `scm_cell' and `scm_double_cell'
> explicitly with "extern" linkage.
>
> Therefore, every file that includes inline.h defines a copy of these
> two functions, each copy with external linkage. This makes it
> impossible to link Guile. (I do not know why this would work with
> gcc; it is definitely wrong.)
>
> The patch below fixes it. inline.c defines the functions with
> external linkage, and every file including inline.h defines static
> inline copies.
We should keep the "extern inline" when compiling with GCC, it is the
Right Thing to do. For non-GCC compilers, we can use "static inline".
I have changed the code in inline.h to, for example
#if defined SCM_C_INLINE && ! defined SCM_INLINE_C_INCLUDING_INLINE_H
/* definitely inlining */
#ifdef __GNUC__
extern
#else
static
#endif
SCM_C_INLINE
#endif
SCM
scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr)
{
...
Ok?
> The same trick needs to be applied to the external/inline functions
> in numbers.h. The patch fixes them as well.
I think we can leave numbers.h alone. The inline functions are not
part of the public API and it is not important that they are inlined
outside of numbers.c, so we don't need to put them into a header file.
We could make them "static inline", with a little bit of work. Would
that be worthwhile?
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
prev parent reply other threads:[~2003-09-12 14:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-19 12:51 [Patch] inline.h should not define inline functions with "extern" linkage Matthias Koeppe
2003-06-21 1:30 ` Kevin Ryde
2003-06-23 8:40 ` Matthias Koeppe
2003-09-12 14:13 ` Marius Vollmer [this message]
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=87vfryqelq.fsf@zagadka.ping.de \
--to=mvo@zagadka.de \
--cc=guile-devel@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).