From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: __attribute__ ((cleanup)) and emacs-module.c Date: Thu, 9 Mar 2023 13:56:28 +0100 Message-ID: References: <87edq7ztks.fsf.ref@yahoo.com> <87ttyzs8q1.fsf@yahoo.com> <253e9494-6f78-89b7-8f5f-9c2e8461d95a@cs.ucla.edu> <878rgaspvs.fsf@yahoo.com> <86bkl6z1sc.fsf@aarsen.me> <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> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32072"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , eggert@cs.ucla.edu, 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 Thu Mar 09 13:57:24 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 1paFpi-00087n-TD for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Mar 2023 13:57:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1paFpB-0006u9-Gu; Thu, 09 Mar 2023 07:56:49 -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 1paFp7-0006sf-9x for emacs-devel@gnu.org; Thu, 09 Mar 2023 07:56:45 -0500 Original-Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paFp5-0004Q5-Il for emacs-devel@gnu.org; Thu, 09 Mar 2023 07:56:45 -0500 Original-Received: by mail-ed1-x534.google.com with SMTP id k10so6467753edk.13 for ; Thu, 09 Mar 2023 04:56:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678366601; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=O/S1+0T03k2uZwDbwTJyS49OIy/5qdH+wu1wc1iR3QU=; b=mk6b4dCJxp4GEFhkVK62xE/A6m30ZhsDLzlwBL81d8fEf9bifkIXHDVkXQqjf1pBjz fMVgdGs/zLhRlhlhjDa8VyfMXr3f7FsokQzA3xamXfbyFRwNBz34fXhUYXb8+uN2zJKZ 6Q2CWDTrJqEcz1ve5f2lBcsq2seKzcKvtCIAhTgxjjTrIqEFkd9eqXUDqYzV9ixR21tr 4KSKaar74nlBiuM4uLY30drSzM3JxBMX9kDqAszp/HNSvaC2YpszS5XQhEz1TZhbg3tb Pm9FuY1g/jMom+KtomW37ADz0d/YyPpLnu68SAKhuBEdCn6nQbml+Ge4NZTx1NpftCPE 9GGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678366601; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O/S1+0T03k2uZwDbwTJyS49OIy/5qdH+wu1wc1iR3QU=; b=qGy+887QYU1MPuqvdHhM1a3mF+mNn45c68EyBsq1RGg/3uF9h5AnC0Lo0Vu4umG0hJ eeLepLODi1rEIm8AHlXM0/BSBo6HleTqOxtR/wxFrHyhrVRc/MaM6PDqjUKC1zdvb5eS ccT8qF7Crq7azrqux0Pa4ao+ipJjJWLXDqxgX3m5UkTs9BvchrdT3NlhZ+I4iFz9J7Uz ixq6/5DLzMGmmsb+swNKUVIeLJzzAp38a8vcgyJ+oxk3e3pbRJdtX0ZfkoC9z+R+lzMK erc9qgsEEUpWP5LpBRU72pcYWYLx4Uhoi+tNsNWE6Nbxz+b93E8wwf7E+Z2NIP9PosPr pT9A== X-Gm-Message-State: AO0yUKVoovKLc5/5fTHq/jJgHEqzfuiISdV8GsjcRB6aTZ8vlIGPWLpM ifA979x/7cSYKyRwsZ1GOnTujQMQArcqWysQmi2PnQ== X-Google-Smtp-Source: AK7set9HvEtR6lEzVfqflqObwPDrP4ZkOhRAHw0QmV4pnM24P0PXK15KYJLorEDoDtqyYq3UoYFqs3qAyGxUCA+3tys= X-Received: by 2002:a17:906:b11a:b0:8f8:edfc:b68b with SMTP id u26-20020a170906b11a00b008f8edfcb68bmr11193007ejy.6.1678366601085; Thu, 09 Mar 2023 04:56:41 -0800 (PST) In-Reply-To: <87cz5ijkek.fsf_-_@yahoo.com> Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=phst@google.com; helo=mail-ed1-x534.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 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:304198 Archived-At: On Thu, 9 Mar 2023 at 11:20, Po Lu wrote: > > Eli Zaretskii writes: > > >> From: Po Lu > >> Cc: eggert@cs.ucla.edu, arsen@aarsen.me, emacs-devel@gnu.org > >> Date: Thu, 09 Mar 2023 16:07:04 +0800 > >> > >> Eli Zaretskii writes: > >> > >> > I disagree with your conclusion, and I still think we should complain > >> > noisily if modules cannot be supported. > >> > >> OK, but I still think this is a very bad idea. Do you object to > >> rewriting emacs-module.c to not utilize __attribute__ ((cleanup))? > >> > >> What was said earlier by some people is wrong: as-is, in Emacs, it makes > >> no difference whether or not we write: > >> > >> foo __attribute__ ((cleanup (module_reset_handlerlist)))... > >> > >> or: > >> > >> foo... > >> module_reset_handlerlist (foo); > > > > If you want to discuss this, please start a new thread and CC Daniel > > Colascione and Philipp Stephani, who I believe wrote that part of > > emacs-module.c. I don't think we should change that without a > > thorough discussion, as that code is quite old and I don't think it > > caused any trouble whatsoever. > > Ok. > > Phillip, Daniel, I'd like to replace the use of the `cleanup' attribute > in emacs-module.c with portable C code. The reason is that it is > implemented unsatisfactorily or not at all in certain compilers I want > to use. This includes Sun C 5.10, and various versions of the Android > NDK GCC that crash generating debuginfo. > > Since Emacs is not built with C++ exception handling, there should be no > reason to use that attribute. Any objections? This attribute is necessary at the moment because otherwise the handlerlist wouldn't get reset when returning from the module implementation functions. Without it, you'd need to audit every occurrence of "return" in the code (including the code generated by the helper macros) and reset the handlerlist manually. This is unrelated to C++ exception handling. It's not impossible to do this manually (it's not so different from the unbind_to calls in the Emacs codebase), but rather error-prone.