From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112828: Merge the specpdl and backtrace stacks. Make the structure of the Date: Tue, 18 Jun 2013 11:50:54 -0700 Message-ID: <51C0AC0E.2020907@cs.ucla.edu> References: <83txlfvw0i.fsf@gnu.org> <51AD8146.8080909@cs.ucla.edu> <83mwr5x62g.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1371581466 30186 80.91.229.3 (18 Jun 2013 18:51:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Jun 2013 18:51:06 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 18 20:51:06 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Up0zh-0003AJ-5X for ged-emacs-devel@m.gmane.org; Tue, 18 Jun 2013 20:51:05 +0200 Original-Received: from localhost ([::1]:34404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up0zg-0001hM-QN for ged-emacs-devel@m.gmane.org; Tue, 18 Jun 2013 14:51:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up0zd-0001fC-4h for emacs-devel@gnu.org; Tue, 18 Jun 2013 14:51:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Up0zc-0004I7-1v for emacs-devel@gnu.org; Tue, 18 Jun 2013 14:51:01 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:47567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up0zZ-0004Hi-Dy; Tue, 18 Jun 2013 14:50:57 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 6BDB9A60001; Tue, 18 Jun 2013 11:50:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R45dIOTL1k5q; Tue, 18 Jun 2013 11:50:55 -0700 (PDT) Original-Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 5B98B39E8100; Tue, 18 Jun 2013 11:50:55 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 In-Reply-To: <83mwr5x62g.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160592 Archived-At: On 06/04/13 08:13, Eli Zaretskii wrote: > My guess would be in lisp.h Since the pattern is used in many .h files, I put the documentation in src/conf_post.h, before the definition of INLINE, EXTERN_INLINE, etc., as trunk bzr 113054 (patch at end of this message). > how to explain the > fact that revision 112828 produced unresolved externals for such > functions that were defined in the same file (eval.c)? 112828 declared LISP_INLINE functions in eval.c. That wasn't right for C99 platforms, because in eval.c LISP_INLINE expands to plain 'inline', and C99 requires that if any module defines a plain inline function FOO (perhaps via a .h file), then FOO must be defined as 'extern inline' in exactly one other module. Eventually this problem got fixed by declaring these as ordinary functions, not as inline functions. I'll add some more documentation to Gnulib about this. The short version is that C code should ordinarily not use 'inline'. The only exception is for functions defined in a .h file, which should be defined using the pattern documented below. === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-18 14:54:48 +0000 +++ src/ChangeLog 2013-06-18 18:36:13 +0000 @@ -1,3 +1,7 @@ +2013-06-18 Paul Eggert + + * conf_post.h: Add comments for INLINE, EXTERN_INLINE, etc. + 2013-06-18 Kenichi Handa * font.c (Ffont_spec): Signal an error for an invalid font name === modified file 'src/conf_post.h' --- src/conf_post.h 2013-03-13 18:42:22 +0000 +++ src/conf_post.h 2013-06-18 18:36:13 +0000 @@ -207,6 +207,37 @@ #undef noinline #endif +/* Use Gnulib's extern-inline module for extern inline functions. + An include file foo.h should prepend FOO_INLINE to function + definitions, with the following overall pattern: + + [#include any other .h files first.] + ... + INLINE_HEADER_BEGIN + #ifndef FOO_INLINE + # define FOO_INLINE INLINE + #endif + ... + FOO_INLINE int + incr (int i) + { + return i + 1; + } + ... + INLINE_HEADER_END + + The corresponding foo.c file should do this: + + #define FOO_INLINE EXTERN_INLINE + + before including any .h file other than config.h. + Other .c files should not define FOO_INILNE. + + C99 compilers compile functions like 'incr' as C99-style extern + inline functions. Pre-C99 GCCs do something similar with + GNU-specific keywords. Pre-C99 non-GCC compilers use static + functions, which bloats the code but is good enough. */ + #define INLINE _GL_INLINE #define EXTERN_INLINE _GL_EXTERN_INLINE #define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN