Roger.Evans@itri.brighton.ac.uk wrote:
: Aaron Sloman wrote:
: >Having rebuilt the system using stdargs I've run quite a lot of tests of
: >X facilities (including XVed and rclib extensions, and some bits of
: >TEACH propsheet, and it all seems to work). I've used grep to search
: >for things that might use varargs. but without success.
: >
: >
: My first reaction to this was to say 'ok if you've tested that much, it
: must be alright'. But I decided to go and have a look at the X sources
: and now I'm not so sure, because the varargs routines are a complete
: parallel set of interfaces that you may well not be using at all. As far
: as I can quickly judge, there are two main places where the X soruces
: make an assumption about how varargs are handled - in the macro
: XTX_VARARGS (x/src/xt_declare.ph) and the varargs coeercion code in
: x/src/xt_call.p - these are then used in various places by the rest of
: the code. (a *caseless* grep for 'varargs' picks up most of the stuff
: one way or another).
: This code assumes that a varags list is terminated by a null on the
: stack (ie not passing the number of args, as I had previously suggested).
Few remarks here:
1) AFAIKS the change to Xpw is internal to Popolog, it does not affects
the way external libraries are called.
2) The main change 'stdarg' brings is that ANSI prototypes apply to
explicitely given arguments, for example single precision floating
point numbers are passed without extending to double precision.
At least on 32 bit machines Poplog should be not affected, as IMHO
it passes only integers and pointers.
3) The code in Xpw probably is broken -- it assumes that one can pass
large fixed number of arguments to a function, regardless of what
given function expects.
4) Testing in i386 Linux is not going catch such problems. Here variable
argument list is passed exactly as a fixed length argument list of
the same length. Also, one can safely pass extra (unexpected) arguments.
5) I really do not understand what Poplog part in Xpw is doing, by my
impression is that at the end it hand agument _array_ to C layer
(as Roger noted using 0 termination to indicate end of the list).
It seems that only place where "varable" argument C calls are made
is function '_XpwMakeCall' in 'CallMethod.c' (which fakes variable
argument list using always 10 arguments).
--
Waldek Hebisch
hebisch@math.uni.wroc.pl
|