🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50994

Re: HELP: `__builtin_va_alist' doesn't match prototype ??

#50994
From: Casper H.S. Dik
Date: Thu, 08 Jul 1993 14:38
54 lines
1898 bytes
koblas@netcom.com (David Koblas) writes:

>Help, I don't use GCC or Sun machines, and this is where this is
>being reported to me as happening.

>Given the following prototype (in a headerfile):

>        void            RWSetMsg(...);

>and the following source file:

>        void RWSetMsg(va_alist)
>        va_dcl
>        {
>                ...
>        }

>What do I need to do to fix the following error message (somewhat
>portably)?

>rwTable.c: In function `RWSetMsg':
>rwTable.c:220: argument `__builtin_va_alist' doesn't match prototype
>*** Error code 1

The fix is easy: write portable code.

You have made two mistakes:

The prototype doesn't match the function definition. You use
a new style prototype but use an old style function declaration.
This is a no-no.

Gcc complaines about this fact.

The other error is the prototype. It isn't a legal ANSI C prototype.
You must specify a first argument in a variadic function.
(Though gcc lets you get away with this)

To fix:

prototype:
	void            RWSetMsg(firstargtype, ...);

definition:

	#include <stdarg.h> /* you've probably got that one already */

	void            RWSetMsg(firstargtype firstarg, ...)
	{
		...
	}


Casper
Technical Details
Message-ID: <21hbho$697@mail.fwi.uva.nl>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!mcsun!sun4nl!fwi.uva.nl!casper
References: <koblasC9uMoJ.9FM@netcom.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,69b9188a562c7d9c
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-07-08 07:59:34 PST
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!mcsun!sun4nl!fwi.uva.nl!casper
From: casper@fwi.uva.nl (Casper H.S. Dik)
Newsgroups: gnu.gcc.help
Subject: Re: HELP: `__builtin_va_alist' doesn't match prototype ??
Date: 8 Jul 1993 14:38:48 GMT
Organization: FWI, University of Amsterdam
Lines: 54
Message-ID: <21hbho$697@mail.fwi.uva.nl>
References: <koblasC9uMoJ.9FM@netcom.com>
NNTP-Posting-Host: adam.fwi.uva.nl