From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: __attribute__ ((cleanup)) and emacs-module.c Date: Sat, 11 Mar 2023 13:21:16 -0800 Organization: UCLA Computer Science Department Message-ID: <64feb9c1-190d-8522-2a90-82f9aa305d12@cs.ucla.edu> References: <87edq7ztks.fsf.ref@yahoo.com> <87mt4qqi2o.fsf@yahoo.com> <83a60q84eo.fsf@gnu.org> <87a60qqb0c.fsf@yahoo.com> <83y1oa6k71.fsf@gnu.org> <87sfehpfcv.fsf@yahoo.com> <83a60o7mif.fsf@gnu.org> <87jzzspvcl.fsf@yahoo.com> <83ttyw65v5.fsf@gnu.org> <4B15D851-5638-48E6-A789-3017A1CBA971@yahoo.com> <8584ff7c-f83e-18b1-1300-dfa0788e4443@cs.ucla.edu> <87v8jbohk4.fsf@yahoo.com> <831qlz5pas.fsf@gnu.org> <87356en2w7.fsf@yahoo.com> <83o7p22xq4.fsf@gnu.org> <875ybal55j.fsf@yahoo.com> <83fsae2sc3.fsf@gnu.org> <87cz5ijkek.fsf_-_@yahoo.com> <87r0tyhwzp.fsf@yahoo.com> <9e84c5c6-337f-e799-f031-1c443aebd412@cs.ucla.edu> <878rg4f4py.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="633"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Cc: Philipp Stephani , Eli Zaretskii , arsen@aarsen.me, emacs-devel@gnu.org, Daniel Colascione To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 11 22:22:16 2023 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 1pb6fP-000AUX-2f for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Mar 2023 22:22:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pb6ei-0002mi-FO; Sat, 11 Mar 2023 16:21:32 -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 1pb6eh-0002ma-Kc for emacs-devel@gnu.org; Sat, 11 Mar 2023 16:21:31 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pb6ef-0002eS-Lw; Sat, 11 Mar 2023 16:21:31 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 50A16160095; Sat, 11 Mar 2023 13:21:18 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id qUt4RK56E548; Sat, 11 Mar 2023 13:21:17 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8651C160098; Sat, 11 Mar 2023 13:21:17 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra.cs.ucla.edu 8651C160098 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=78364E5A-2AF3-11ED-87FA-8298ECA2D365; t=1678569677; bh=CExUk2uDalKh9pt1fS9jW1Y9sDzEVtAN/M8zrL+aYz0=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type: Content-Transfer-Encoding; b=Y0JqGItd8bzhkPpArFs3V/V9i2ZVMFCoe9kjKxihW/uj11YH01oi29GwHHcW56ixJ GxOeKX1BBZ1v2HZ+DNsiqh8GnTODSpyGCHU2OZmZQ0EqEdAZ1tcXbJYk3xy4P2H9w9 vrJUdvZD5N3+/W3vIodYS1OeJUwbwT3vMwAxzkBE= X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wMKOskMTB5Zh; Sat, 11 Mar 2023 13:21:17 -0800 (PST) Original-Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3E134160095; Sat, 11 Mar 2023 13:21:17 -0800 (PST) Content-Language: en-US In-Reply-To: <878rg4f4py.fsf@yahoo.com> Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304341 Archived-At: On 2023-03-10 17:37, Po Lu wrote: > +#define MODULE_INTERNAL_CLEANUP \ > + module_reset_handlerlist (&internal_cleanup) No need for the "&" here. Omit it, and change the type of module_reset_handlerlist to take 'struct handler *' instead of 'struct handler **'. Also, please make this macro a parameterless function-style macro called via 'MODULE_INTERNAL_CLEANUP ()' as it acts like a function. Also, please define a macro MODULE_FUNCTION_END something like this: #define MODULE_FUNCTION_END(retval) \ (MODULE_INTERNAL_CLEANUP (), retval) and use 'return MODULE_FUNCTION_END ();' when the cleanup is immediately followed by a return of a value of a simple expression. For complex expressions that can throw exceptions, you can use something like: r = ; return MODULE_FUNCTION_END (r);