- Modernise function declarations in Cephis C math to address ongoing GCC and Clang warnings.

Examples:

/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c: In function ‘c_exp’:
/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c:171:48: warning: declaration of built-in function ‘floor’ without a prototype; expected ‘double(double)’ [-Wbuiltin-declaration-mismatch]
  171 | double polevl(double, void *, int), floor(), ldexp();
      |                                                ^~~~~
/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c:171:57: warning: declaration of built-in function ‘ldexp’ without a prototype; expected ‘double(double,  int)’ [-Wbuiltin-declaration-mismatch]
  171 | double polevl(double, void *, int), floor(), ldexp();

/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c:200:16: warning: passing arguments to 'polevl' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
px = x * polevl( xx, P, 2 );
               ^
/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c:201:17: warning: passing arguments to 'polevl' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
x =  px/( polevl( xx, Q, 3 ) - px );
                ^
/home/mrichters/Repos/Raze/source/common/thirdparty/math/exp.c:167:8: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
double c_exp(x)
       ^
3 warnings generated.
This commit is contained in:
Mitchell Richters 2023-10-05 10:32:44 +11:00 committed by Christoph Oelckers
parent 790fc0b28a
commit 39df2714e9
16 changed files with 28 additions and 61 deletions

View file

@ -276,8 +276,7 @@ double c_asin();
#endif
extern double PIO2, PIO4, NAN;
double c_asin(x)
double x;
double c_asin(double x)
{
double a, p, z, zz;
short sign;
@ -327,8 +326,7 @@ return(z);
double c_acos(x)
double x;
double c_acos(double x)
{
if( (x < -1.0) || (x > 1.0) )
{

View file

@ -212,8 +212,7 @@ extern double PI, PIO2, PIO4, INFINITY, NEGZERO, MAXNUM;
#endif
double c_atan(x)
double x;
double c_atan(double x)
{
double y, z;
short sign, flag;
@ -269,11 +268,10 @@ return(y);
/* atan2 */
#ifdef ANSIC
double c_atan2( y, x )
double c_atan2(double y, double x)
#else
double c_atan2( x, y )
double c_atan2(double x, double y)
#endif
double x, y;
{
double z, w;
short code;

View file

@ -79,8 +79,7 @@ int isnan(), isfinite();
#endif
extern double MAXLOG, INFINITY, LOGE2;
double c_cosh(x)
double x;
double c_cosh(double x)
{
double y;

View file

@ -164,12 +164,11 @@ static short sc2[] = {0x3eb7,0xf7d1,0xcf79,0xabca};
extern double LOGE2, LOG2E, MAXLOG, MINLOG, MAXNUM;
double c_exp(x)
double x;
double c_exp(double x)
{
double px, xx;
int n;
double polevl(), floor(), ldexp();
double polevl(double, void *, int), floor(double), ldexp(double, int);
if( x > MAXLOG)
{

View file

@ -99,8 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* Return 1 if the sign bit of x is 1, else 0. */
int signbit(x)
double x;
int signbit(double x)
{
union
{
@ -140,8 +139,7 @@ else
/* Return 1 if x is a number that is Not a Number, else return 0. */
int isnan(x)
double x;
int isnan(double x)
{
#ifdef NANS
union
@ -209,8 +207,7 @@ return(0);
/* Return 1 if x is not infinite and is not a NaN. */
int isfinite(x)
double x;
int isfinite(double x)
{
#ifdef INFINITIES
union

View file

@ -230,8 +230,7 @@ int isnan(), isfinite();
#define SQRTH 0.70710678118654752440
extern double INFINITY, NAN;
double c_log(x)
double x;
double c_log(double x)
{
int e;
#ifdef DEC

View file

@ -178,8 +178,7 @@ int isnan(), isfinite();
#endif
extern double LOGE2, SQRT2, INFINITY, NAN;
double c_log10(x)
double x;
double c_log10(double x)
{
VOLATILE double z;
double y;

View file

@ -99,9 +99,7 @@ static char *ermsg[7] = {
};
int mtherr( name, code )
char *name;
int code;
int mtherr(char* name, int code)
{
/* Display string passed by calling program,

View file

@ -75,10 +75,7 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
*/
double polevl( x, coef, N )
double x;
double coef[];
int N;
double polevl(double x, double coef[], int N)
{
double ans;
int i;
@ -101,10 +98,7 @@ return( ans );
* Otherwise same as polevl.
*/
double p1evl( x, coef, N )
double x;
double coef[];
int N;
double p1evl(double x, double coef[], int N)
{
double ans;
double *p;

View file

@ -387,8 +387,7 @@ extern double NAN;
extern double NEGZERO;
#endif
double c_pow( x, y )
double x, y;
double c_pow(double x, double y)
{
double w, z, W, Wa, Wb, ya, yb, u;
/* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
@ -768,8 +767,7 @@ return( z );
/* Find a multiple of 1/16 that is within 1/16 of x. */
static double reduc(x)
double x;
static double reduc(double x)
{
double t;

View file

@ -78,9 +78,7 @@ int signbit();
#endif
extern double NEGZERO, INFINITY, MAXNUM, MAXLOG, MINLOG, LOGE2;
double c_powi( x, nn )
double x;
int nn;
double c_powi(double x, int nn)
{
int n, e, sign, asign, lx;
double w, y, s;

View file

@ -238,8 +238,7 @@ extern double INFINITY;
#endif
double c_sin(x)
double x;
double c_sin(double x)
{
double y, z, zz;
int j, sign;
@ -318,8 +317,7 @@ return(y);
double c_cos(x)
double x;
double c_cos(double x)
{
double y, z, zz;
int i;
@ -403,8 +401,7 @@ static unsigned short P648[] = {034513,054170,0176773,0116043,};
static double P64800 = 4.8481368110953599358991410e-5;
#endif
double radian(d,m,s)
double d,m,s;
double radian(double d, double m, double s)
{
return( ((d*60.0 + m)*60.0 + s)*P64800 );

View file

@ -132,8 +132,7 @@ double fabs(), c_exp(), polevl(), p1evl();
#endif
extern double INFINITY, MINLOG, MAXLOG, LOGE2;
double c_sinh(x)
double x;
double c_sinh(double x)
{
double a;

View file

@ -78,8 +78,7 @@ double frexp(), ldexp();
#endif
extern double SQRT2; /* _sqrt2 = 1.41421356237309504880 */
double c_sqrt(x)
double x;
double c_sqrt(double x)
{
int e;
#ifndef UNK

View file

@ -220,8 +220,7 @@ extern double PIO4;
extern double INFINITY;
extern double NAN;
double c_tan(x)
double x;
double c_tan(double x)
{
#ifdef MINUSZERO
if( x == 0.0 )
@ -240,8 +239,7 @@ return( tancot(x,0) );
}
double c_cot(x)
double x;
double c_cot(double x)
{
if( x == 0.0 )
@ -253,9 +251,7 @@ return( tancot(x,1) );
}
static double tancot( xx, cotflg )
double xx;
int cotflg;
static double tancot(double xx, int cotflg)
{
double x, y, z, zz;
int j, sign;

View file

@ -128,8 +128,7 @@ double fabs(), c_exp(), polevl(), p1evl();
#endif
extern double MAXLOG;
double c_tanh(x)
double x;
double c_tanh(double x)
{
double s, z;