Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Steve Preston
Tue, 06 Oct 1992 14:40
stdarg/varargs and the v?printf's on HP700
Author: Steve Preston
Date: Tue, 06 Oct 1992 14:40
Date: Tue, 06 Oct 1992 14:40
38 lines
1697 bytes
1697 bytes
HP9000/720 HPUX 8.07 gcc 2.2.2 (configured for hppa1.1-hp-hpux)
This is really HP's fault, I would guess.
The GNU C compiler defines its own version of stdarg/varargs data
structures, defining the type va_list as a structure of pointers,
thusly:
typedef struct
{
char *__va_stack_start; /* Real start of stack args. */
char *__va_int; /* Pointer to the general register */
/* args and stack. */
char *__va_float; /* Pointer to the fp register args. */
char *__va_double;
} va_list;
In the HPUX headers, the v?printf's are declared to take the type
__va_list which is typedef'ed as a pointer to double. So any calls to
v?printf either cause a compile error or fail badly at runtime.
I have experimentally determined that one should pass the __va_int
member to v?printf, (cast as a (double *) or (__va_list) to suppress a
warning, if desired).
This perhaps could be fixed by including a set of macros such as
#define vprintf(a,b) vprintf(a,(__va_list)(b).__va_int)
to the gnu include files. Except that would interfere with the
declaration of vprintf in stdio.h.
A better fix would be to write vprintf et.al., using _doprnt, which
HP's libc apparently contains, to do the work.
--
Steve Preston (scp2@gte.com)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads