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 13:33:18 -0700 Message-ID: <874jw26vht.fsf@rfc20.org> References: <874jw37764.fsf@rfc20.org> <835ygj3rqp.fsf@gnu.org> <877d0y6zex.fsf@rfc20.org> <83ilki1cyo.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="6714"; 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 22:35:01 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 1okWp7-0001O8-15 for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 22:34:57 +0200 Original-Received: from localhost ([::1]:58174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okWp5-00073D-DR for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 16:34:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okWnj-0006Cn-7g for emacs-devel@gnu.org; Mon, 17 Oct 2022 16:33:42 -0400 Original-Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:41197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okWne-00057P-8P; Mon, 17 Oct 2022 16:33:30 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id CB53160002; Mon, 17 Oct 2022 20:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1666038801; 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=69wznhpwyXkAXgN7Z2WCh/MOBSx60WM3HifyU7FGiis=; b=bOv9v/vZmk75XLsRHHVwsNnN/TwUMKmB4C0TE4FLaqQT+wySShoOwn2DzZRNAt4OEKpkJk A8zHlLRR9yaRFS/1lYHovhVproBwK9FcXOUd+JYvVoMI7tlaC/MpO4scjiIjBOrVYVHrhD 46oFWNTPXZSBqiHmBEjoYcITUQcBM72xsf0t1sVBwR37YyrBsT26XC2ot7QRrS3tCGC++e frQ1f89/7QXAX7D37s9yqzs6mDDPznLtQqe0kaho0lHS4Duur/qTuPAYRR8tHrh+Iv1hSE LQUMYJDM8YedPZdPVd7WQVZ4RJx61oaCXjkCAKmn5wYWe6VWScfg4MTcSUq2CQ== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1okWnW-001AgU-1y; Mon, 17 Oct 2022 13:33:18 -0700 In-Reply-To: <83ilki1cyo.fsf@gnu.org> Received-SPF: pass client-ip=2001:4b98:dc4:8::223; envelope-from=matt@rfc20.org; helo=relay3-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:297984 Archived-At: Eli Zaretskii writes: >> From: Matt Armstrong >> Cc: emacs-devel@gnu.org >> Date: Mon, 17 Oct 2022 12:08:38 -0700 >> >> > 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. > > Why would you need 'inline' anywhere else? That is the question I started the thread with, in different words. If you grep our sources 'static inline' appears in .c files, and I wondered why. Stefan gave an answer in the form of a question (he was concerned about what gcc did at optimization level -Og). I investigated and found that gcc (and clang) will inline a static function at -Og level only if the function uses the inline keyword. So a "static inline" function is useful in the case where you want some key static functions inlined, but everything else still relatively unoptimized.