NeedWidePrototypes not defined correctly without imake

Keith Packard keithp at keithp.com
Sun Dec 5 20:24:59 PST 2004


I've discovered a serious ABI compatibility issue for any target which 
sets NeedWidePrototype to NO.  This list includes uncommon operating 
systems like cygwin, FreeBSD, GNU/Hurd, linux, lynx, mach, mingw, NetBSD, 
OpenBSD, os2, QNX, sco, sgi and usl.

The problem is that wide prototypes are the default and each of these 
systems overrides them, but *only when you use imake*.  Any hapless 
application (like Qt, Gnome, Mozilla, et al) which builds with some other 
mechanism will get the wrong function defintions.

Of course, most of the time this does no harm in practice.  The Xlib APIs 
use this to check whether a keycode argument is CARD8 or unsigned int (!), 
few machines can pass CARD8 in anything smaller than an unsigned int.  

The only place I've found an actual problem is in Xaw where floating point 
values are passed as 'double' from applications and interpreted as 'float' 
in the library. This (oddly) causes things to break badly.

I'm not sure how we're expected to fix this; the imake rules for selecting
which platforms use narrow prototypes seems arbitrary and capricious to me;
without codifying the precise rules by which a particular operating system
.cf file is selected and precisely which operating system .cf files
actually use narrow prototypes, I submit that the current ABI specification
is incomplete.

Xlib is specified in terms of K&R C prototypes; I don't know who decided 
that it was OK to reinterpret them as ANSI C prototypes and change the 
effective types of all of the arguments, but there's not a lot we can do 
about it now; the effective ABI on Linux is the ANSI types, not the K&R 
types, and that effective ABI is *not used* unless you build with imake 
today.

I don't know what to do to fix this.  What a mess.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20041205/17da057e/attachment.pgp>


More information about the xorg mailing list