From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: #2 [Was: Re: Function attributes for make-docfile] Date: Tue, 13 Jan 2015 15:26:09 -0800 Organization: UCLA Computer Science Department Message-ID: <54B5A991.8010509@cs.ucla.edu> References: <54B348E8.7080203@yandex.ru> <54B3604E.9020304@cs.ucla.edu> <54B3BDE3.8030602@yandex.ru> <54B4C971.7010209@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000407050906040804070806" X-Trace: ger.gmane.org 1421191597 485 80.91.229.3 (13 Jan 2015 23:26:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Jan 2015 23:26:37 +0000 (UTC) Cc: Dmitry Antipov , Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 14 00:26:31 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YBAr0-0005oa-0L for ged-emacs-devel@m.gmane.org; Wed, 14 Jan 2015 00:26:30 +0100 Original-Received: from localhost ([::1]:41831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBAqz-00015E-GO for ged-emacs-devel@m.gmane.org; Tue, 13 Jan 2015 18:26:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBAqk-00014v-Q9 for emacs-devel@gnu.org; Tue, 13 Jan 2015 18:26:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBAqh-0001dU-KI for emacs-devel@gnu.org; Tue, 13 Jan 2015 18:26:14 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:56179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBAqh-0001dH-C1 for emacs-devel@gnu.org; Tue, 13 Jan 2015 18:26:11 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 43244A6011B; Tue, 13 Jan 2015 15:26:10 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4YvV1drbOVIy; Tue, 13 Jan 2015 15:26:09 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 5BB0CA6011A; Tue, 13 Jan 2015 15:26:09 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181243 Archived-At: This is a multi-part message in MIME format. --------------000407050906040804070806 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 01/13/2015 11:45 AM, Stefan Monnier wrote: > IOW it is*not* a const function. To fix this I installed the attached patch as master commit 785adfcc8dee02ac544f80e4f7f8d3d5b2965981 . It's not pretty, but at least we're no longer lying to the compiler. --------------000407050906040804070806 Content-Type: text/x-patch; name="0001-Don-t-say-Fnext_read_file_uses_dialog_p-is-const.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Don-t-say-Fnext_read_file_uses_dialog_p-is-const.patch" >From c020d2f7eee565616dff21e9d22b3200a4d5debf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 13 Jan 2015 15:22:19 -0800 Subject: [PATCH] Don't say Fnext_read_file_uses_dialog_p is const It's const only if a windowing system is not used; don't say it's const otherwise. See: http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00310.html * lib-src/make-docfile.c (write_globals): Add a special hack for Fnext_read_file_uses_dialog_p. * src/fileio.c (next_read_file_uses_dialog_p): Remove. Move guts back to ... (Fnext_read_file_uses_dialog_p): ... here. Don't declare as const, as make-docfile.c now has a special case for this function. This is an ugly hack, but it's better than lying to the compiler. --- lib-src/ChangeLog | 6 ++++++ lib-src/make-docfile.c | 12 ++++++++++++ src/ChangeLog | 11 +++++++++++ src/fileio.c | 30 ++++++++++-------------------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 969aac8..e9205fd 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,9 @@ +2015-01-13 Paul Eggert + + Don't say Fnext_read_file_uses_dialog_p is const + * make-docfile.c (write_globals): + Add a special hack for Fnext_read_file_uses_dialog_p. + 2015-01-13 Dmitry Antipov Support DEFUN attributes. diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 79d421a..741fa4b 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -729,6 +729,18 @@ write_globals (void) if (globals[i].flags & DEFUN_const) fputs (" ATTRIBUTE_CONST", stdout); + else if (strcmp (globals[i].name, "Fnext_read_file_uses_dialog_p") + == 0) + { + /* It would be nice to have a cleaner way to deal with this + special hack. */ + fputs (("\n" + "#if ! (defined USE_GTK || defined USE_MOTIF \\\n" + " || defined HAVE_NS || defined HAVE_NTGUI)\n" + "\tATTRIBUTE_CONST\n" + "#endif\n"), + stdout); + } puts (";"); } diff --git a/src/ChangeLog b/src/ChangeLog index 7ec6980..8d05ec1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2015-01-13 Paul Eggert + Don't say Fnext_read_file_uses_dialog_p is const + It's const only if a windowing system is not used; don't say it's + const otherwise. See: + http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00310.html + * fileio.c (next_read_file_uses_dialog_p): Remove. + Move guts back to ... + (Fnext_read_file_uses_dialog_p): ... here. + Don't declare as const, as make-docfile.c now has a special case + for this function. This is an ugly hack, but it's better than + lying to the compiler. + Remove now-unnecessary forward XTYPE decl * lisp.h (XTYPE): Remove forward declaration. The recent merge from emacs-24 fixed the problem in a better way, by moving XPNTR's diff --git a/src/fileio.c b/src/fileio.c index 45a31c0..6c443c9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5734,34 +5734,24 @@ then any auto-save counts as "recent". */) return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil); } -/* We want Fnext_read_file_uses_dialog_p to have ATTRIBUTE_CONST - regardless of #ifdefs, so there is a trivial workaround. See - http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00289.html. */ - -static bool -next_read_file_uses_dialog_p (void) -{ -#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \ - || defined (HAVE_NS) - return ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) - && use_dialog_box - && use_file_dialog - && window_system_available (SELECTED_FRAME ())); -#endif - return false; -} - /* Reading and completing file names. */ DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p, Snext_read_file_uses_dialog_p, 0, 0, 0, doc: /* Return t if a call to `read-file-name' will use a dialog. The return value is only relevant for a call to `read-file-name' that happens -before any other event (mouse or keypress) is handled. */ - attributes: const) +before any other event (mouse or keypress) is handled. */) (void) { - return next_read_file_uses_dialog_p () ? Qt : Qnil; +#if (defined USE_GTK || defined USE_MOTIF \ + || defined HAVE_NS || defined HAVE_NTGUI) + if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + && use_dialog_box + && use_file_dialog + && window_system_available (SELECTED_FRAME ())) + return Qt; +#endif + return Qnil; } void -- 2.1.0 --------------000407050906040804070806--