Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503296 - dev-lang/swi-prolog-7.1.8 USE=readline with sys-libs/readline-6.3 - os/pl-rl.c:99:1: error: unknown type name ‘Function’
Summary: dev-lang/swi-prolog-7.1.8 USE=readline with sys-libs/readline-6.3 - os/pl-rl....
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prolog project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: readline-6.3
  Show dependency tree
 
Reported: 2014-03-03 10:00 UTC by Martin von Gagern
Modified: 2014-03-06 08:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (dev-lang:swi-prolog-7.1.8:20140303-094020.log,77.89 KB, text/plain)
2014-03-03 10:00 UTC, Martin von Gagern
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2014-03-03 10:00:30 UTC
Created attachment 371634 [details]
build log

Upgrading dev-lang/swi-prolog from 7.1.7 to 7.1.8, I got the following error:

os/pl-rl.c:99:1: error: unknown type name ‘Function’
os/pl-rl.c:99:18: error: conflicting types for ‘rl_event_hook’
In file included from os/pl-rl.c:87:0:
/usr/include/readline/readline.h:569:24: note: previous declaration of ‘rl_event_hook’ was here
os/pl-rl.c: In function ‘Sread_readline’:
os/pl-rl.c:450:16: warning: assignment from incompatible pointer type [enabled by default]
Makefile:183: recipe for target 'os/pl-rl.o' failed

The file in question, os/pl-rl.c, has not changed between these versions. Indeed, remerging 7.1.7 fails with the same error. This appears to be due to a readline upgrade. Between 6.2_p5-r1 and 6.3, the following was removed from /usr/include/readline/rltypedefs.h:

/* Old-style */

#if !defined (_FUNCTION_DEF)
#  define _FUNCTION_DEF

typedef int Function ();
typedef void VFunction ();
typedef char *CPFunction ();
typedef char **CPPFunction ();

#endif /* _FUNCTION_DEF */

So this is where the Function type comes from. The global variable rl_event_hook is declared in readline.h as

extern rl_hook_func_t *rl_event_hook;

which according to rltypedefs.h is

typedef int rl_hook_func_t PARAMS((void));

So perhaps the correct fix would be using that type. Since the latest readline:0 is 6.2_p1 which already does provide that rl_hook_func_t typedef, I guess we don't need any support for older readline versions.
Comment 1 Martin von Gagern 2014-03-03 10:01:37 UTC
Other packages are affected by this as well, see e.g. bug 503180.
Comment 2 Maks Verver 2014-03-04 19:34:03 UTC
Can confirm this bug. Simply deleting line 99 from os/pl-rl.c fixes the problem, since the correct declaration is already available in readline.h.

I've also reported the bug upstream:

http://www.swi-prolog.org/bugzilla/show_bug.cgi?id=162
Comment 3 Keri Harris gentoo-dev 2014-03-06 08:43:04 UTC
Thanks for reporting this bug. I've patched pl-6.6.2 and pl-7.1.9 with upstream commit e23683d2 [1]

[1] http://www.swi-prolog.org/git/pl.git/commit/e23683d2