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.
This commit is contained in:
Paul Eggert 2015-01-13 15:22:19 -08:00
parent 5647847662
commit 785adfcc8d
4 changed files with 39 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2015-01-13 Paul Eggert <eggert@cs.ucla.edu>
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 <dmantipov@yandex.ru>
Support DEFUN attributes.

View file

@ -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 (";");
}

View file

@ -1,5 +1,16 @@
2015-01-13 Paul Eggert <eggert@cs.ucla.edu>
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

View file

@ -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