* GCC warning in minibuf.c
@ 2005-10-20 12:32 Eli Zaretskii
2005-10-20 13:07 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2005-10-20 12:32 UTC (permalink / raw)
Cc: Andreas Schwab
With today's CVS, GCC 3.4.2 issues the following warning:
minibuf.c: In function `Fminibuffer_completion_help':
minibuf.c:2578: warning: passing arg 2 of `internal_with_output_to_temp_buffer' from incompatible pointer type
This happens because internal_with_output_to_temp_buffer is declared
as follows:
Lisp_Object
internal_with_output_to_temp_buffer (bufname, function, args)
const char *bufname;
Lisp_Object (*function) P_ ((Lisp_Object));
Lisp_Object args;
Here, the 2nd argument `function' is declared to accept a single
Lisp_Object argument. However, minibuf.c calls
internal_with_output_to_temp_buffer as follows:
internal_with_output_to_temp_buffer ("*Completions*",
Fdisplay_completion_list,
Fsort (completions, Qstring_lessp));
and Fdisplay_completion_list is declared to accept 2 Lisp_Object
arguments.
I think this is a bogus warning, but I'm not sure what would be the
best way to shut up the compiler. One way to do that is to modify the
above declaration of internal_with_output_to_temp_buffer like this:
Lisp_Object
internal_with_output_to_temp_buffer (bufname, function, args)
const char *bufname;
Lisp_Object (*function) ();
Lisp_Object args;
However, the current full-prototype declaration was introduced (in
1998 by Andreas) instead of the incomplete one, so it sounds like a
step backwards. OTOH, Andreas wanted to fix warnings under
the -Wimplicit option, which we don't use in compiling Emacs.
Suggestions?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC warning in minibuf.c
2005-10-20 12:32 GCC warning in minibuf.c Eli Zaretskii
@ 2005-10-20 13:07 ` Andreas Schwab
2005-10-20 13:38 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2005-10-20 13:07 UTC (permalink / raw)
Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> Here, the 2nd argument `function' is declared to accept a single
> Lisp_Object argument. However, minibuf.c calls
> internal_with_output_to_temp_buffer as follows:
>
> internal_with_output_to_temp_buffer ("*Completions*",
> Fdisplay_completion_list,
> Fsort (completions, Qstring_lessp));
>
> and Fdisplay_completion_list is declared to accept 2 Lisp_Object
> arguments.
Then Fdisplay_completion_list is definitely the wrong function to pass to
internal_with_output_to_temp_buffer.
> I think this is a bogus warning,
I don't agree. Fdisplay_completion_list will be called with only a single
parameter and will receive garbage in the second one. A sure way to make
Emacs crash.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC warning in minibuf.c
2005-10-20 13:07 ` Andreas Schwab
@ 2005-10-20 13:38 ` Eli Zaretskii
2005-10-20 13:57 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2005-10-20 13:38 UTC (permalink / raw)
Cc: emacs-devel
> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org
> Date: Thu, 20 Oct 2005 15:07:47 +0200
>
> > I think this is a bogus warning,
>
> I don't agree. Fdisplay_completion_list will be called with only a single
> parameter and will receive garbage in the second one. A sure way to make
> Emacs crash.
Perhaps I misunderstand what the code does, but it looks like
internal_with_output_to_temp_buffer invokes the `function' argument
with a list of arguments, which seems to suggest that any number of
arguments will do.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC warning in minibuf.c
2005-10-20 13:38 ` Eli Zaretskii
@ 2005-10-20 13:57 ` Andreas Schwab
2005-10-20 15:03 ` Kim F. Storm
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2005-10-20 13:57 UTC (permalink / raw)
Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> Perhaps I misunderstand what the code does, but it looks like
> internal_with_output_to_temp_buffer invokes the `function' argument
> with a list of arguments,
???
val = (*function) (args);
Looks very much like passing a single argument.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC warning in minibuf.c
2005-10-20 13:57 ` Andreas Schwab
@ 2005-10-20 15:03 ` Kim F. Storm
0 siblings, 0 replies; 5+ messages in thread
From: Kim F. Storm @ 2005-10-20 15:03 UTC (permalink / raw)
Cc: Eli Zaretskii, emacs-devel
Andreas Schwab <schwab@suse.de> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Perhaps I misunderstand what the code does, but it looks like
>> internal_with_output_to_temp_buffer invokes the `function' argument
>> with a list of arguments,
>
> ???
>
> val = (*function) (args);
>
> Looks very much like passing a single argument.
>
Indeed. I have installed a fix. Thanks.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-10-20 15:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-20 12:32 GCC warning in minibuf.c Eli Zaretskii
2005-10-20 13:07 ` Andreas Schwab
2005-10-20 13:38 ` Eli Zaretskii
2005-10-20 13:57 ` Andreas Schwab
2005-10-20 15:03 ` Kim F. Storm
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).