From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: 27bb4de72b * Port cleanup attribute to Oracle Studio 12.5 Date: Wed, 14 Jun 2017 11:25:52 -0700 Organization: UCLA Computer Science Department Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A6DD780AFF3806B6CE997076" X-Trace: blaine.gmane.org 1497464778 7714 195.159.176.226 (14 Jun 2017 18:26:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Jun 2017 18:26:18 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 To: Philipp Stephani , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 14 20:26:14 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLCzc-0001dd-1i for ged-emacs-devel@m.gmane.org; Wed, 14 Jun 2017 20:26:12 +0200 Original-Received: from localhost ([::1]:50369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLCzh-000609-1d for ged-emacs-devel@m.gmane.org; Wed, 14 Jun 2017 14:26:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLCzV-0005yc-LU for emacs-devel@gnu.org; Wed, 14 Jun 2017 14:26:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLCzS-0007nJ-Ci for emacs-devel@gnu.org; Wed, 14 Jun 2017 14:26:05 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:36860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLCzR-0007mo-UV for emacs-devel@gnu.org; Wed, 14 Jun 2017 14:26:02 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8934D1600A6; Wed, 14 Jun 2017 11:26:00 -0700 (PDT) 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 OSv09M0QsSRa; Wed, 14 Jun 2017 11:25:59 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0499B1600D8; Wed, 14 Jun 2017 11:25:59 -0700 (PDT) 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 ojogSN8UpnmA; Wed, 14 Jun 2017 11:25:58 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B42761600A6; Wed, 14 Jun 2017 11:25:58 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215628 Archived-At: This is a multi-part message in MIME format. --------------A6DD780AFF3806B6CE997076 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 06/14/2017 03:29 AM, Philipp Stephani wrote: > > the commit message says "The C compiler should check the cleanup > attribute in the next line anyway." But that's not the case: unknown > attributes are silently ignored, at least in Clang. The > verify(__has_attribute(cleanup)) or equivalent is absolutely required > here. Can we revert that commit? No, because the 'verify' breaks the build with Oracle Studio 12.5, where __has_attribute works only inside preprocessor conditionals. I installed the attached patch, which checks for __attribute__ (cleanup) in a different way. But while we're on the subject, wouldn't it be better if emacs-module.c were made to work (albeit perhaps less efficiently) even on compilers that do not support this nonstandard C extension? Another thing. Have you had a chance to think about related questions I asked about recently installed portability changes? Here are the URLs: http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00225.html http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00226.html Since then I see that you installed another patch (commit 32d8dba625fc50ccbe28e35afcf1f0529d611e00) to pacify Clang on macOS; this patch unfortunately could cause trouble on non-POSIX platforms where rlim_t is signed. Pacifying Clang shouldn't be at the cost of portability or unnecessary complexity. And I'm still puzzled as to why you're getting the Clang warnings but I am not. Are you using an older Clang? Are you passing it extra warning options? --------------A6DD780AFF3806B6CE997076 Content-Type: text/x-patch; name="0001-Port-cleanup-check-to-Oracle-Studio-12.5.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Port-cleanup-check-to-Oracle-Studio-12.5.patch" >From 80f8f15b5e9d6776948adedc8b1ab25c2a41df6e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 14 Jun 2017 11:01:02 -0700 Subject: [PATCH] Port cleanup check to Oracle Studio 12.5 * src/conf_post.h (__has_attribute_cleanup): Resurrect. * src/emacs-module.c: Verify __has_attribute (cleanup), but in an #if this time. --- src/conf_post.h | 5 ++++- src/emacs-module.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/conf_post.h b/src/conf_post.h index 18b096e..e1d6a93 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -57,10 +57,13 @@ typedef bool bool_bf; #endif /* Simulate __has_attribute on compilers that lack it. It is used only - on arguments like alloc_size that are handled in this simulation. */ + on arguments like alloc_size that are handled in this simulation. + __has_attribute should be used only in #if expressions, as Oracle + Studio 12.5's __has_attribute does not work in plain code. */ #ifndef __has_attribute # define __has_attribute(a) __has_attribute_##a # define __has_attribute_alloc_size GNUC_PREREQ (4, 3, 0) +# define __has_attribute_cleanup GNUC_PREREQ (3, 4, 0) # define __has_attribute_externally_visible GNUC_PREREQ (4, 1, 0) # define __has_attribute_no_address_safety_analysis false # define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0) diff --git a/src/emacs-module.c b/src/emacs-module.c index de62329..5c413ee 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -170,6 +170,10 @@ static struct emacs_env_private global_env_private; internal_handler_##handlertype, \ internal_cleanup_##handlertype) +#if !__has_attribute (cleanup) + #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC" +#endif + /* It is very important that pushing the handler doesn't itself raise a signal. Install the cleanup only after the handler has been pushed. Use __attribute__ ((cleanup)) to avoid -- 2.9.4 --------------A6DD780AFF3806B6CE997076--