Operating System - HP-UX
1834305 Members
1994 Online
110066 Solutions
New Discussion

Re: Compile errors at 11.0 for routine using varargs.h

 
SOLVED
Go to solution
Tom Peterson
New Member

Compile errors at 11.0 for routine using varargs.h

I have some code that includes varargs.h that compiles (cc) fine at 10.20, but gives me compile errors at 11.0. I use the following command to compile it:
cc -g -z -D_HPUX_SOURCE -DPTY_ENABLE -I/usr/local/include tlp.c

but get the following errors:
cpp: "tlp.c", line 181: warning 2005: va_start: Too few parameters (1) to macro.
cpp: "tlp.c", line 863: warning 2005: va_start: Too few parameters (1) to macro.
cpp: "tlp.c", line 891: warning 2005: va_start: Too few parameters (1) to macro.
cc: "tlp.c", line 175: error 1000: Unexpected symbol: "va_dcl".
cc: "tlp.c", line 181: error 1000: Unexpected symbol: ")".
cc: "tlp.c", line 153: error 1523: Too many initializers.
cc: "tlp.c", line 181, error 1609: Incorrect usage of the va_start macro: need a
va_list variable and an identifier which is the rightmost parameter in the va_list.

I've noticed that a 10.20 the default "standard" option is -Ac, but at 11.0 it's -Aa. If I use -Ac I don't get any compile errors or warnings, but I'm afraid the executable won't run correctly on PA RISC 2.

Has anyone else seen this? Is there an easy solution (I'm sure there is; I always choose to do things the hardest possible way).

Thanks.
1 REPLY 1
Jason Deckard
Occasional Advisor
Solution

Re: Compile errors at 11.0 for routine using varargs.h

Hi Tom,

The stdarg(5) man page implies that varargs(5) is nonportable. Using the macros in stdarg.h (as opposed to the function in vararg.h) should solve both your compile time errors and quell you concerns of portability.

HTH
[Insert humorous and/or inspirational quote here]