Operating System - HP-UX
1753716 Members
4581 Online
108799 Solutions
New Discussion

warning #2140-D: too many arguments in function call with va_alist

 
ASR
Contributor

warning #2140-D: too many arguments in function call with va_alist

Hi,

Could anybody help on the below issue. I am facing this error on HP Itanium with bot cc and aCC

err_sys.h:
==========

#include
#include
int err_sys(va_alist)
va_dcl
{
char *frmt,*varg1;
va_list ap;
va_start(ap);
frmt=va_arg(ap,char *);
varg1=va_arg(ap,char *);
printf("Variable Args are: %s\n", varg1);
va_end(ap);
return 0;
}

varlist.c:
===========

#include "err_sys.h"
int err_sys();

int main()
{
err_sys("%s: signal %d, sts = %d, prev = %d", "India, 123, 456, 789");
return 0;

}

compilation line:
=================

cc +DD64 -o result +M2 -DCMMSG_RV -DUNIX -D_HPUX_SOURCE -D_REENTRANT -D_PTHREADS_DRAFT4 varlist.c

"varlist.c", line 6: warning #2140-D: too many arguments in function call
err_sys("%s: signal %d, sts = %d, prev = %d", "India, 123, 456, 789");
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: warning #2140-D: too many arguments in function call with va_alist

K&R is NOT supported on IPF. You must port your code to use:
#include <stdarg.h>
...
int err_sys(const char *frmt, ...) {
    const char *varg1;
    va_list ap;
    va_start(ap, frmt);
    varg1=va_arg(ap, const char*);

Replace +M2 by +w64bit.
-D_PTHREADS_DRAFT4 is NOT available on IPF. You should be using kernel threads, even on PA.
If you want to use libpthread, you should compile with -mt.