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

View file

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

View file

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

View file

@ -164,12 +164,11 @@ static short sc2[] = {0x3eb7,0xf7d1,0xcf79,0xabca};
extern double LOGE2, LOG2E, MAXLOG, MINLOG, MAXNUM; extern double LOGE2, LOG2E, MAXLOG, MINLOG, MAXNUM;
double c_exp(x) double c_exp(double x)
double x;
{ {
double px, xx; double px, xx;
int n; int n;
double polevl(), floor(), ldexp(); double polevl(double, void *, int), floor(double), ldexp(double, int);
if( x > MAXLOG) 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. */ /* Return 1 if the sign bit of x is 1, else 0. */
int signbit(x) int signbit(double x)
double x;
{ {
union union
{ {
@ -140,8 +139,7 @@ else
/* Return 1 if x is a number that is Not a Number, else return 0. */ /* Return 1 if x is a number that is Not a Number, else return 0. */
int isnan(x) int isnan(double x)
double x;
{ {
#ifdef NANS #ifdef NANS
union union
@ -209,8 +207,7 @@ return(0);
/* Return 1 if x is not infinite and is not a NaN. */ /* Return 1 if x is not infinite and is not a NaN. */
int isfinite(x) int isfinite(double x)
double x;
{ {
#ifdef INFINITIES #ifdef INFINITIES
union union

View file

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

View file

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

View file

@ -99,9 +99,7 @@ static char *ermsg[7] = {
}; };
int mtherr( name, code ) int mtherr(char* name, int code)
char *name;
int code;
{ {
/* Display string passed by calling program, /* 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 polevl(double x, double coef[], int N)
double x;
double coef[];
int N;
{ {
double ans; double ans;
int i; int i;
@ -101,10 +98,7 @@ return( ans );
* Otherwise same as polevl. * Otherwise same as polevl.
*/ */
double p1evl( x, coef, N ) double p1evl(double x, double coef[], int N)
double x;
double coef[];
int N;
{ {
double ans; double ans;
double *p; double *p;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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