From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: [Patch] inline.h should not define inline functions with "extern" linkage Date: Fri, 12 Sep 2003 16:13:37 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87vfryqelq.fsf@zagadka.ping.de> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1063376111 5202 80.91.224.253 (12 Sep 2003 14:15:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Sep 2003 14:15:11 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Sep 12 16:15:07 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19xohW-0007X0-01 for ; Fri, 12 Sep 2003 16:15:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19xogL-00088T-Bp for guile-devel@m.gmane.org; Fri, 12 Sep 2003 10:13:53 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19xogC-00087C-Sl for guile-devel@gnu.org; Fri, 12 Sep 2003 10:13:44 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19xogB-00086o-5v for guile-devel@gnu.org; Fri, 12 Sep 2003 10:13:43 -0400 Original-Received: from [129.217.163.1] (helo=mail.dt.e-technik.uni-dortmund.de) by monty-python.gnu.org with esmtp (Exim 4.22) id 19xogA-00086U-Rz for guile-devel@gnu.org; Fri, 12 Sep 2003 10:13:42 -0400 Original-Received: from zagadka.ping.de (zagadka.dt.e-technik.uni-dortmund.de [129.217.163.6]) by mail.dt.e-technik.uni-dortmund.de (Postfix) with SMTP id D883AC59D for ; Fri, 12 Sep 2003 16:13:39 +0200 (CEST) Original-Received: (qmail 8599 invoked by uid 1000); 12 Sep 2003 14:13:37 -0000 Original-To: Matthias Koeppe In-Reply-To: (Matthias Koeppe's message of "Thu, 19 Jun 2003 14:51:55 +0200") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2779 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2779 Matthias Koeppe 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