Gentoo Archives: gentoo-ppc-user

From: Stefan Boresch <stefan@×××××××××××××.at>
To: gentooppc-user@g.o
Subject: Re: [gentooppc-user] First impressions, and a puzzle
Date: Fri, 06 Sep 2002 10:22:49
Message-Id: 20020906152248.GA18471@mdy.univie.ac.at
1 On Fri, Sep 06, 2002 at 09:07:42AM -0600, Stuart M Jansen wrote:
2 > *snip*
3 > > Second, I have a puzzle: The attached C code mimics
4 > > something used in a routine belonging to the 'babel'
5 > *snip*
6
7 > > initap=ap;
8 >
9 > Not having access to a compiler at the moment and only limited experience with
10 > variable length C functions, looks like the above line is your problem. Gcc 3.*
11 > is much more standards compliant than the 2.95 and that _may_ be the reason it
12 > is rejecting it. If this function truly mimics the real one, then initap isn't
13 > used and can be removed. The maintainers of babel may not yet have checked to
14 > make sure their software can compile with the 3.* series. You might want to
15 > encourage them to.
16
17 Thanks for the quick reply (and you spotted the offending line
18 correctly :-). I should have googled a bit before posting (this problem
19 has bitten other packages on ppc, debian lists have a lot of stuff:
20 Anyways, here is the solution (I guess I should file a bug report):
21
22 -------------
23
24 >From info libc, variadic function, Argument Macros...:
25
26 - Macro: void __va_copy (va_list DEST, va_list SRC)
27 The `__va_copy' macro allows copying of objects of type `va_list'
28 even if this is not an integral type. The argument pointer in
29 DEST is initialized to point to the same argument as the pointer
30 in SRC.
31
32 This macro is a GNU extension but it will hopefully also be
33 available in the next update of the ISO C standard.
34
35 If you want to use `__va_copy' you should always be prepared for the
36 possibility that this macro will not be available. On architectures
37 where a simple assignment is invalid, hopefully `__va_copy' _will_ be
38 available, so one should always write something like this:
39
40 {
41 va_list ap, save;
42 ...
43 #ifdef __va_copy
44 __va_copy (save, ap);
45 #else
46 save = ap;
47 #endif
48 ...
49 }
50
51 -------------
52
53 Replacing the simple assignment as suggested makes everything
54 compile...
55
56 Thanks again,
57
58 Stefan
59
60 --
61 Stefan Boresch
62 Institute for Theoretical Chemistry and Structural Molecular Biology
63 University of Vienna, Waehringerstr. 17 A-1090 Vienna, Austria
64 Phone: -43-1-427752715 Fax: -43-1-427752790