Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error while compilation after porting.

Status
Not open for further replies.

sab1234

Programmer
Sep 29, 2003
11
0
0
US
Hi,

I ported some c++ applications from HP-UX10.20 to HP-UX11.11. When I tried compiling the applications I got the following warning message:

passing arg 2 of `svc_sendreply' from incompatible pointer type

for the line:

(void) svc_sendreply(transp, xdr_void,(char *)NULL);

Can anyone please help me on this.

Thanks,
Anand.


 
The compiler doesn't like the data type of 'xdr_void'.

The prototype for scv_sendreply() is:

Code:
bool_t svc_sendreply(const SVCXPRT *xprt, const xdrproc_t outproc, const caddr_t out);

Check the definition of xdr_void. I suspect it may actually be a pointer that just needs dereferencing.

Hope that helps,
Jason Deckard
 
Jason,

Thanks for your reply. But I don't find the definition of xdr_void in my code. Please find below the function from which I am getting this error:

static void
vatprog_1(rqstp, transp)
struct svc_req *rqstp;
register SVCXPRT *transp;
{
union {
CustomerInfo_parms customerinfo_1_arg;
ReportRequest_parms reportrequest_1_arg;
MailRequest_parms mailrequest_1_arg;
AddDeleteFeature_parms adddeletefeature_1_arg;
BalRequest_parms clm_account_bal_1_arg;
BillInfo_parms billinfo_1_arg;
OneTimePayment_parms onetimepayment_1_arg;
FeatureInfo_parms featureinfo_1_arg;
ESNChange_parms esnchange_1_arg;
GroupCallingInfo_parms groupcallinginfo_1_arg;
GroupCallingUpdate_parms groupcallingupdate_1_arg;
AcctBal_parms acctbal_1_arg;
RecurringCCPayment_parms recurringccpayment_1_arg;
NumberOfCCPayments_parms numberofccpayments_1_arg;
} argument;
char *result;
bool_t (*xdr_argument)(), (*xdr_result)();
char *(*local)();

_rpcsvccount++;
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply(transp, xdr_void,
(char *)NULL);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
return;

case CUSTOMERINFO:
xdr_argument = xdr_CustomerInfo_parms;
xdr_result = xdr_CustomerInfo_results;
local = (char *(*)()) customerinfo_1;
break;

case REPORTREQUEST:
xdr_argument = xdr_ReportRequest_parms;
xdr_result = xdr_ReportRequest_results;
local = (char *(*)()) reportrequest_1;
break;

case MAILREQUEST:
xdr_argument = xdr_MailRequest_parms;
xdr_result = xdr_MailRequest_results;
local = (char *(*)()) mailrequest_1;
break;

case ADDDELETEFEATURE:
xdr_argument = xdr_AddDeleteFeature_parms;
xdr_result = xdr_AddDeleteFeature_results;
local = (char *(*)()) adddeletefeature_1;
break;

case CLM_ACCOUNT_BAL:
xdr_argument = xdr_BalRequest_parms;
xdr_result = xdr_BalRequest_results;
local = (char *(*)()) clm_account_bal_1;
break;

case BILLINFO:
xdr_argument = xdr_BillInfo_parms;
xdr_result = xdr_BillInfo_results;
local = (char *(*)()) billinfo_1;
break;

case ONETIMEPAYMENT:
xdr_argument = xdr_OneTimePayment_parms;
xdr_result = xdr_OneTimePayment_results;
local = (char *(*)()) onetimepayment_1;
break;

case FEATUREINFO:
xdr_argument = xdr_FeatureInfo_parms;
xdr_result = xdr_FeatureInfo_results;
local = (char *(*)()) featureinfo_1;
break;

case ESNCHANGE:
xdr_argument = xdr_ESNChange_parms;
xdr_result = xdr_ESNChange_results;
local = (char *(*)()) esnchange_1;
break;

case GROUPCALLINGINFO:
xdr_argument = xdr_GroupCallingInfo_parms;
xdr_result = xdr_GroupCallingInfo_results;
local = (char *(*)()) groupcallinginfo_1;
break;

case GROUPCALLINGUPDATE:
xdr_argument = xdr_GroupCallingUpdate_parms;
xdr_result = xdr_GroupCallingUpdate_results;
local = (char *(*)()) groupcallingupdate_1;
break;

case ACCTBAL:
xdr_argument = xdr_AcctBal_parms;
xdr_result = xdr_AcctBal_results;
local = (char *(*)()) acctbal_1;
break;

case RECURRINGCCPAYMENT:
xdr_argument = xdr_RecurringCCPayment_parms;
xdr_result = xdr_RecurringCCPayment_results;
local = (char *(*)()) recurringccpayment_1;
break;

case NUMBEROFCCPAYMENTS:
xdr_argument = xdr_NumberOfCCPayments_parms;
xdr_result = xdr_NumberOfCCPayments_results;
local = (char *(*)()) numberofccpayments_1;
break;

default:
svcerr_noproc(transp);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
return;
}
(void) memset((char *)&argument, 0, sizeof (argument));
if (!svc_getargs(transp, (char *)xdr_argument, (char *)&argument)) {
svcerr_decode(transp);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
return;
}
result = (*local)(&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
svcerr_systemerr(transp);
}
if (!svc_freeargs(transp,xdr_argument, (char *)&argument)) {
_msgout("unable to free arguments");
exit(1);
}
_rpcsvccount--;
_rpcsvcstate = _SERVED;
return;
}

I am also getting the same warning for the functions svc_getargs and svc_freeargs.

Can you or anyone else please help me out on this. I am new in programming and don't have much idea about solving such kind of problems.

-Anand
 
I think the key to solving the problem with svc_sendreply() is to find the definition for xdr_void. It may be a global variable, a typedef, or preprocessor definition.

It may seem a bit daunting since you're new to programming, but I won't be able to provide any specific help until I can see how xdr_void is defined.

Perhaps you can grep for the definition of xdr_void?


Good luck,

Jason
 
Jason,

I get the same warning message for the following lines also:

if (!svc_getargs(transp, xdr_argument, (char *)&argument))

if (result != NULL && !svc_sendreply(transp, xdr_result, result))

here xdr_argument and xdr_result are defined as:

bool_t (*xdr_argument)(), (*xdr_result)();

Can you please tell me how do I resolve the problem for these cases.

Thanks,
-Anand


 
xdr_argument and xdr_result are being declared the same way that xdrproc_t is; however, they are not of type xdrproc_t (which is what svc_getargs() and svc_sendreply() are expecting).

Try defining xdr_argument and xdr_result as:
Code:
xdrproc_t xdr_argument, xdr_result;
 
Thanks Jason,

After defining the xdr_argument, xdr_result and xdr_void as xdrproc_t, I have got rid of the previous error but Now I am getting the following warning message:

warning: assignment from incompatible pointer type

for the lines:

xdr_argument = xdr_CustomerInfo_parms;
xdr_result = xdr_CustomerInfo_results;

Any help will be highly appreciated.

-Anand.
 
Try typecasting the arguments in the code,

xdr_argument = (const xdrproc_t)xdr_CustomerInfo_parms;
xdr_result = (const xdrproc_t)xdr_CustomerInfo_results;

I think this shall remove the warning but do confirm if the definition of "const xdrproc_t" is something like "bool_t (*xdrproc_t)()".
Because if not, this is a serious problem and you might get problems on run time.

 
Thanks Jason

Hi,

I am getting the following warning messages while compiling some C codes in HP-UX10.20:

warning: passing arg 3 of pointer to function from incompatible pointer type
warning: passing arg 5 of pointer to function from incompatible pointer type

for the line:

if (clnt_call(clnt, REPORTREQUEST, xdr_ReportRequest_axysresults, (char
*)argp, xdr_ReportRequest_retcode, (char *)&res, TIMEOUT) != RPC_SUCCESS)


I am aware that xdr_ReportRequest_axysresults(3rd argument) and xdr_ReportRequest_retcode(5th argument)should be of the type xdproc_t.

In my case they are defined as
bool_t xdr_CustomerInfo_axysresults(); and
bool_t xdr_ReportRequest_retcode();

When I try to define the arguments as
xdrproc_t xdr_CustomerInfo_axysresults; or
xdrproc_t xdr_ReportRequest_retcode;

I get the following error:

error: 'xdrproc_t' is used as a type, but is not defined as a type.

Can you please help me out on this.

Thanks,
Anand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top