[PHP-DEV] Bug #1636: functions/snmp.c compile fails with SW cc From: cab <email protected>
Date: 06/30/99

From: cab <email protected>
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.

-- 
PHP Development Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>