From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.devel Subject: Re: Emacs' C: static inline considered useless nowadays? Date: Mon, 17 Oct 2022 12:08:38 -0700 Message-ID: <877d0y6zex.fsf@rfc20.org> References: <874jw37764.fsf@rfc20.org> <835ygj3rqp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 17 21:11:54 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okVWk-0006nA-A8 for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 21:11:54 +0200 Original-Received: from localhost ([::1]:40130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okVWj-00045p-5j for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 15:11:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okVTm-0001a4-Q9 for emacs-devel@gnu.org; Mon, 17 Oct 2022 15:08:50 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:49811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okVTj-0000ts-CK; Mon, 17 Oct 2022 15:08:49 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id B48BB60002; Mon, 17 Oct 2022 19:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1666033724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+JLeCeSFluCcHgcrve/Qx8zubPbMC8NnxA39Z5EV/q0=; b=otqbb3OmXbUqkyYWgzkHWYtxevBIhMhOlV/WG1mTRGpqaVPoxWlXxD8/1cDtpaGtLeCSnP arle2yG6AkaGN+ChcETRNaBCC9J7jA4E7iCu58eU8Ljs+umNyHg6jOTkjrKmv2TAoRbCtd BcWnN+cNfTl2dHf06+cY4G0ATTV2a7/LmKl0I4u0rbfqpuo8DpMrnzzhMTb5vlRetA+KjM YQspSNV29oXyaPU7ieyZqJXPq6EqqUxP/o0ydmbE8gEMFvsdNSXxq/K8JoUdKmMqOqTFNN zcsFbKbPilgmBfU4nkGYtwJeSvGIiN+j9lsAom68JbtyxioKl8LextIrbVb3dA== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1okVTa-001AY7-1T; Mon, 17 Oct 2022 12:08:38 -0700 In-Reply-To: <835ygj3rqp.fsf@gnu.org> Received-SPF: pass client-ip=217.70.183.195; envelope-from=matt@rfc20.org; helo=relay3-d.mail.gandi.net X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, THIS_AD=0.4 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297980 Archived-At: Eli Zaretskii writes: >> From: Matt Armstrong >> Date: Sun, 16 Oct 2022 15:08:51 -0700 >> >> For Emacs, I would think: >> >> a) In header files, use Emacs' INLINE and NO_INLINE macros. >> >> b) In .c files, use static, EXTERN_INLINE, but never 'inline' since it >> does nothing. >> >> I'm seeking confirmation (or refutation) of (a) and (b). I'm not asking >> generally, but for Emacs' C code. > > See conf_post.h, around line 395: it explains the issue and the > expected usage of these in our sources. conf_post.h didn't answer my question since it seems to pertain to code in header files. I realize now that the conclusion of this thread so far is unclear: a) "static inline" in .c files is okay. No need for macros. b) Criteria for when to use "static inline" is not clear. Do we do this ad hoc as -Og builds are discovered to be slow? Do it for all static functions? Don't care? I can see cases for any of these. c) Neither (a) nor (b) are written down, and as Eli points out, conf_post.h suggests that at least sometimes you've got to use macros for inline functions in Emacs code, but that header is about how to do things in header files.