From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms Date: Wed, 11 Dec 2024 18:38:32 -0500 Message-ID: References: <2C0B7D3A-6131-4427-BF04-9211981B57DD@gmail.com> <867c8g3o6v.fsf@gnu.org> <0D278D91-4D67-4E0E-869F-6AF0A46678F7@gmail.com> <791c31a1-84ab-4cab-921b-cc8977e980d9@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4278"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , Eli Zaretskii , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 12 00:39:17 2024 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 1tLWIW-00011n-RU for ged-emacs-devel@m.gmane-mx.org; Thu, 12 Dec 2024 00:39:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLWHs-0001Jz-2H; Wed, 11 Dec 2024 18:38:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLWHp-00013X-Py for emacs-devel@gnu.org; Wed, 11 Dec 2024 18:38:33 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLWHp-0007U3-G8; Wed, 11 Dec 2024 18:38:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=4xhd2lGKODULajDyQkjRgOga50SOFswAbAZyhvmxOVU=; b=nzLjQtJmS78uX+BxI+qI pqtNGoaIeh0y6RRIszypYFWFkb3NbhpoaGeKN0aVehvllmbFYtJu004NKQquLqy5UcmBTaZ+kYUbN 6cIASxwo8lS/FZtXfvO9rCigLCv0W0gb2zOjoin7Q0Hs1Fw2gvYXb+zhxcXHuz4TgDCp3JxgjfBUf GqN+Q+qA5wflim0xLtjJ7b5tWwABRt4AHneiGfkZihMKXmyqYva9ghHio9ZV0uFtxHworfLwOjEOV qbkleOuHrNG4cKzDNDZT2uWMlsHHYy/73ta1OaO2nN3js5z3TRny3x+tb8KxgCdAB/jymVUGhJv6a Bu4w/RYOOxRbuA==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tLWHo-0007vr-7a; Wed, 11 Dec 2024 18:38:32 -0500 In-Reply-To: <791c31a1-84ab-4cab-921b-cc8977e980d9@gutov.dev> (Dmitry Gutov's message of "Sun, 8 Dec 2024 18:01:39 +0200") 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326387 Archived-At: Dmitry Gutov writes: > On 04/12/2024 20:19, Yuan Fu wrote: >> When Emacs is built without tree-sitter, none of the treesit.c functions are available (except for treesit-ready-p) > > Have we considered having all of those functions defined but doing > nothing in that case? Alias them to 'ignore' or something that raises > an error. > > I think then we won't have to maintain these 'declare-function' lists > in every package that depends on treesit.c. The suggestion of having the C functions defined to nops when HAVE_TREE_SITTER is not defined is cleaner in principle, but I think there are two downsides: - We don't tipically do it this way, so it would be an exception - Also we should do it for all the functions in treesit.c, otherwise we don't solve the original problem of introducing warnings by mistake on non treesit builds. Andrea