Bug #1636: functions/snmp.c compile fails with SW cc
| From: | cab at tc dot umn dot edu | Date: | Wed, 30 Jun 1999 18:13:41 +0000 |
| Subject: | Bug #1636: functions/snmp.c compile fails with SW cc | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7887@lists.php.net to get a copy of this message | ||
From: cab@tc.umn.edu
Operating system: Solaris 2.6
PHP version: 3.0.11
PHP Bug Type: Compile Failure
Bug description: functions/snmp.c compile fails with SW cc
Building for apache (APXS) with UCD SNMP 3.5 (thus --enable-ucd-snmp-hack).
Using Sun SPARCworks cc 4.2 on Solaris 2.6.
Compilation fails for functions/snmp.c with:
"functions/snmp.c", line 159: syntax error before or at: {
"functions/snmp.c", line 159: syntax error before or at: )
"functions/snmp.c", line 165: syntax error before or at: if
"functions/snmp.c", line 165: cannot recover from previous errors
Line 159 reads:
if(myargc != 1 || getParameters(ht, myargc, &a1)) return(WRONG_PARAM_COUNT);
Expanding things manually with the C preprocessor shows the problem:
if(myargc != 1 || getParameters(ht, myargc, &a1)) return( { wrong_param_count( ) ; return ;
});
cc doesn't like the block in the arguments for return. Removing the return() around
WRONG_PARAM_COUNT fixes this problem but reveals another:
"functions/snmp.c", line 312: void function cannot return value
"functions/snmp.c", line 320: void function cannot return value
"functions/snmp.c", line 328: void function cannot return value
"functions/snmp.c", line 336: void function cannot return value
"functions/snmp.c", line 344: void function cannot return value
Each of these looks like:
return _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
where the function itself is declared to return void and _php3_snmp also returns void. Apparently
cc doesn't like either invoking a void function in a context that expects a return value, or
doesn't like using return with an argument in a void function. Changing each of these to:
_php_snmp(INERNAL_FUNCTION_PARAM_PASSTHRU,2);
return;
fixes this problem.