This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Got compiler warning when compiling readline module
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, benjamin.peterson, ned.deily, serhiy.storchaka, vajrasky
Priority: normal Keywords: patch

Created on 2014-02-06 07:58 by vajrasky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_compile_warning_readline.patch vajrasky, 2014-02-06 07:58 review
Messages (6)
msg210364 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-02-06 07:58
On Fedora 20, I got this compiler warning:

/home/sky/Code/python/cpython3.4/Modules/readline.c: In function ‘flex_complete’:
/home/sky/Code/python/cpython3.4/Modules/readline.c:962:5: warning: passing argument 1 of ‘completion_matches’ discards ‘const’ qualifier from pointer target type [enabled by default]
     result = completion_matches(text, *on_completion);
     ^
/home/sky/Code/python/cpython3.4/Modules/readline.c:40:15: note: expected ‘char *’ but argument is of type ‘const char *’
 extern char **completion_matches(char *, rl_compentry_func_t *);
               ^

Here is the patch using Christian Heimes' strategy in silencing compiler warning in dbm module.
http://hg.python.org/cpython/rev/3068ff3d9d1e
msg210367 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-06 08:47
What will happen if change the signature of completion_matches to "const char*"?
msg210370 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-02-06 10:06
It works. I chose Christian Heimes' strategy because of: 

char ** completion_matches (char *text, CPFunction *entry_func)
in
http://web.mit.edu/gnu/doc/html/rlman_2.html
msg210569 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-07 22:22
Interesting, how compiler got this warning? In readline6 the declarations of legacy functions including completion_matches are in "#if 0" block. In libedit it declared with "const char *".
msg210588 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-02-08 05:03
It's weird. When I make clean and configure again and make again, the error warning message disappear. Prior to that, I could confirm, I was in this block:

#ifdef HAVE_RL_COMPLETION_MATCHES
#define completion_matches(x, y) \
    rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
#else
#if defined(_RL_FUNCTION_TYPEDEF)

Here I am!!!!!!!!!!!!!!!!!!!!

extern char **completion_matches(char *, rl_compentry_func_t *);
#else

#if !defined(__APPLE__)
extern char **completion_matches(char *, CPFunction *);
#endif
#endif
#endif
msg210592 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-08 07:13
Then perhaps this is just misconfiguration.
History
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64724
2017-03-07 19:18:33serhiy.storchakasetstatus: pending -> closed
resolution: works for me
stage: resolved
2015-09-20 21:27:53serhiy.storchakasetstatus: open -> pending
2014-02-08 07:13:06serhiy.storchakasetmessages: + msg210592
2014-02-08 05:03:43vajraskysetmessages: + msg210588
2014-02-07 22:22:39serhiy.storchakasetmessages: + msg210569
2014-02-06 10:06:27vajraskysetmessages: + msg210370
2014-02-06 08:47:08serhiy.storchakasetnosy: + serhiy.storchaka, benjamin.peterson, ned.deily
messages: + msg210367
2014-02-06 08:19:56Arfreversetnosy: + Arfrever
2014-02-06 08:19:49Arfreversetversions: + Python 2.7, Python 3.3
2014-02-06 07:58:12vajraskycreate