Print this page
10882 math headers should stop supporting K&R C

Split Close
Expand all
Collapse all
          --- old/usr/src/head/math.h
          +++ new/usr/src/head/math.h
↓ open down ↓ 58 lines elided ↑ open up ↑
  59   59  #endif
  60   60  
  61   61  #ifdef __cplusplus
  62   62  extern "C" {
  63   63  #endif
  64   64  
  65   65  #if defined(__cplusplus)
  66   66  #define exception       __math_exception
  67   67  #endif
  68   68  
  69      -#ifndef __P
  70      -#ifdef __STDC__
  71      -#define __P(p)  p
  72      -#else
  73      -#define __P(p)  ()
  74      -#endif
  75      -#endif  /* !defined(__P) */
  76      -
  77   69  #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) || \
  78   70          !defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)
  79   71  /*
  80   72   * SVID & X/Open
  81   73   */
  82   74  #define M_E             2.7182818284590452354
  83   75  #define M_LOG2E         1.4426950408889634074
  84   76  #define M_LOG10E        0.43429448190325182765
  85   77  #define M_LN2           0.69314718055994530942
  86   78  #define M_LN10          2.30258509299404568402
↓ open down ↓ 53 lines elided ↑ open up ↑
 140  132  #define _POLY6(x, c)    (_POLY5((x), (c)) * (x) + (c)[6])
 141  133  #define _POLY7(x, c)    (_POLY6((x), (c)) * (x) + (c)[7])
 142  134  #define _POLY8(x, c)    (_POLY7((x), (c)) * (x) + (c)[8])
 143  135  #define _POLY9(x, c)    (_POLY8((x), (c)) * (x) + (c)[9])
 144  136  #endif  /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */
 145  137  
 146  138  /*
 147  139   * SVID & X/Open
 148  140   */
 149  141  /* BEGIN adopted by C99 */
 150      -extern double erf __P((double));
 151      -extern double erfc __P((double));
 152      -extern double hypot __P((double, double));
 153      -extern double lgamma __P((double));
      142 +extern double erf(double);
      143 +extern double erfc(double);
      144 +extern double hypot(double, double);
      145 +extern double lgamma(double);
 154  146  
 155  147  #if defined(__MATHERR_ERRNO_DONTCARE)
 156  148  #pragma does_not_read_global_data(erf, erfc, hypot)
 157  149  #pragma does_not_write_global_data(erf, erfc, hypot)
 158  150  #pragma no_side_effect(erf, erfc, hypot)
 159  151  #endif
 160  152  
 161  153  #if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__)
 162      -extern int isnan __P((double));
      154 +extern int isnan(double);
 163  155  
 164  156  #pragma does_not_read_global_data(isnan)
 165  157  #pragma does_not_write_global_data(isnan)
 166  158  #pragma no_side_effect(isnan)
 167  159  #endif
 168  160  /* END adopted by C99 */
 169  161  
 170  162  #if defined(__EXTENSIONS__) || _XOPEN_SOURCE - 0 < 600
 171      -extern double gamma __P((double));              /* deprecated; use lgamma */
      163 +extern double gamma(double);            /* deprecated; use lgamma */
 172  164  #endif
 173      -extern double j0 __P((double));
 174      -extern double j1 __P((double));
 175      -extern double jn __P((int, double));
 176      -extern double y0 __P((double));
 177      -extern double y1 __P((double));
 178      -extern double yn __P((int, double));
      165 +extern double j0(double);
      166 +extern double j1(double);
      167 +extern double jn(int, double);
      168 +extern double y0(double);
      169 +extern double y1(double);
      170 +extern double yn(int, double);
 179  171  
 180  172  #if defined(__MATHERR_ERRNO_DONTCARE)
 181  173  #pragma does_not_read_global_data(j0, j1, jn, y0, y1, yn)
 182  174  #pragma does_not_write_global_data(j0, j1, jn, y0, y1, yn)
 183  175  #pragma no_side_effect(j0, j1, jn, y0, y1, yn)
 184  176  #endif
 185  177  #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || \
 186  178          _XOPEN_SOURCE - 0 >= 500 || \
 187  179          defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1
 188  180  /*
 189  181   * SVID & XPG 4.2/5
 190  182   */
 191      -extern double scalb __P((double, double));
      183 +extern double scalb(double, double);
 192  184  
 193  185  #if defined(__MATHERR_ERRNO_DONTCARE)
 194  186  #pragma does_not_read_global_data(scalb)
 195  187  #pragma does_not_write_global_data(scalb)
 196  188  #pragma no_side_effect(scalb)
 197  189  #endif
 198  190  
 199  191  /* BEGIN adopted by C99 */
 200      -extern double acosh __P((double));
 201      -extern double asinh __P((double));
 202      -extern double atanh __P((double));
 203      -extern double cbrt __P((double));
 204      -extern double logb __P((double));
 205      -extern double nextafter __P((double, double));
 206      -extern double remainder __P((double, double));
      192 +extern double acosh(double);
      193 +extern double asinh(double);
      194 +extern double atanh(double);
      195 +extern double cbrt(double);
      196 +extern double logb(double);
      197 +extern double nextafter(double, double);
      198 +extern double remainder(double, double);
 207  199  
 208  200  /*
 209  201   * XPG 4.2/5
 210  202   */
 211      -extern double expm1 __P((double));
 212      -extern int ilogb __P((double));
 213      -extern double log1p __P((double));
 214      -extern double rint __P((double));
      203 +extern double expm1(double);
      204 +extern int ilogb(double);
      205 +extern double log1p(double);
      206 +extern double rint(double);
 215  207  
 216  208  #if defined(__MATHERR_ERRNO_DONTCARE)
 217  209  #pragma does_not_read_global_data(acosh, asinh, atanh, cbrt)
 218  210  #pragma does_not_read_global_data(logb, nextafter, remainder)
 219  211  #pragma does_not_read_global_data(expm1, ilogb, log1p, rint)
 220  212  #pragma does_not_write_global_data(acosh, asinh, atanh, cbrt)
 221  213  #pragma does_not_write_global_data(logb, nextafter, remainder)
 222  214  #pragma does_not_write_global_data(expm1, ilogb, log1p, rint)
 223  215  #pragma no_side_effect(acosh, asinh, atanh, cbrt)
 224  216  #pragma no_side_effect(logb, nextafter, remainder)
 225  217  #pragma no_side_effect(expm1, ilogb, log1p, rint)
 226  218  #endif
 227  219  /* END adopted by C99 */
 228  220  #endif  /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || ... */
 229  221  
 230  222  #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE)
 231  223  /*
 232  224   * SVID
 233  225   */
 234      -extern int matherr __P((struct exception *));
      226 +extern int matherr(struct exception *);
 235  227  
 236  228  /*
 237  229   * IEEE Test Vector
 238  230   */
 239      -extern double significand __P((double));
      231 +extern double significand(double);
 240  232  
 241  233  #if defined(__MATHERR_ERRNO_DONTCARE)
 242  234  #pragma does_not_read_global_data(significand)
 243  235  #pragma does_not_write_global_data(significand)
 244  236  #pragma no_side_effect(significand)
 245  237  #endif
 246  238  
 247  239  extern int signgamf;                            /* deprecated; use signgam */
 248  240  extern int signgaml;                            /* deprecated; use signgam */
 249  241  
 250      -extern int isnanf __P((float));
 251      -extern int isnanl __P((long double));
 252      -extern float gammaf __P((float));               /* deprecated; use lgammaf */
 253      -extern float gammaf_r __P((float, int *));      /* deprecated; use lgammaf_r */
 254      -extern float j0f __P((float));
 255      -extern float j1f __P((float));
 256      -extern float jnf __P((int, float));
 257      -extern float lgammaf_r __P((float, int *));
 258      -extern float scalbf __P((float, float));
 259      -extern float significandf __P((float));
 260      -extern float y0f __P((float));
 261      -extern float y1f __P((float));
 262      -extern float ynf __P((int, float));
 263      -extern long double gammal __P((long double));   /* deprecated; use lgammal */
 264      -extern long double gammal_r __P((long double, int *));  /* deprecated */
 265      -extern long double j0l __P((long double));
 266      -extern long double j1l __P((long double));
 267      -extern long double jnl __P((int, long double));
 268      -extern long double lgammal_r __P((long double, int *));
 269      -extern long double scalbl __P((long double, long double));
 270      -extern long double significandl __P((long double));
 271      -extern long double y0l __P((long double));
 272      -extern long double y1l __P((long double));
 273      -extern long double ynl __P((int, long double));
      242 +extern int isnanf(float);
      243 +extern int isnanl(long double);
      244 +extern float gammaf(float);             /* deprecated; use lgammaf */
      245 +extern float gammaf_r(float, int *);    /* deprecated; use lgammaf_r */
      246 +extern float j0f(float);
      247 +extern float j1f(float);
      248 +extern float jnf(int, float);
      249 +extern float lgammaf_r(float, int *);
      250 +extern float scalbf(float, float);
      251 +extern float significandf(float);
      252 +extern float y0f(float);
      253 +extern float y1f(float);
      254 +extern float ynf(int, float);
      255 +extern long double gammal(long double); /* deprecated; use lgammal */
      256 +extern long double gammal_r(long double, int *);        /* deprecated */
      257 +extern long double j0l(long double);
      258 +extern long double j1l(long double);
      259 +extern long double jnl(int, long double);
      260 +extern long double lgammal_r(long double, int *);
      261 +extern long double scalbl(long double, long double);
      262 +extern long double significandl(long double);
      263 +extern long double y0l(long double);
      264 +extern long double y1l(long double);
      265 +extern long double ynl(int, long double);
 274  266  
 275  267  #if defined(__MATHERR_ERRNO_DONTCARE)
 276  268  #pragma does_not_read_global_data(isnanf, isnanl)
 277  269  #pragma does_not_write_global_data(isnanf, isnanl)
 278  270  #pragma no_side_effect(isnanf, isnanl)
 279  271  #pragma does_not_read_global_data(gammaf_r, j0f, j1f, jnf, lgammaf_r, scalbf)
 280  272  #pragma does_not_read_global_data(significandf, y0f, y1f, ynf)
 281  273  #pragma does_not_write_global_data(j0f, j1f, jnf, scalbf)
 282  274  #pragma does_not_write_global_data(significandf, y0f, y1f, ynf)
 283  275  #pragma no_side_effect(j0f, j1f, jnf, scalbf)
↓ open down ↓ 2 lines elided ↑ open up ↑
 286  278  #pragma does_not_read_global_data(significandl, y0l, y1l, ynl)
 287  279  #pragma does_not_write_global_data(j0l, j1l, jnl, scalbl)
 288  280  #pragma does_not_write_global_data(significandl, y0l, y1l, ynl)
 289  281  #pragma no_side_effect(j0l, j1l, jnl, scalbl)
 290  282  #pragma no_side_effect(significandl, y0l, y1l, ynl)
 291  283  #endif
 292  284  
 293  285  /*
 294  286   * for sin+cos->sincos transformation
 295  287   */
 296      -extern void sincos __P((double, double *, double *));
 297      -extern void sincosf __P((float, float *, float *));
 298      -extern void sincosl __P((long double, long double *, long double *));
      288 +extern void sincos(double, double *, double *);
      289 +extern void sincosf(float, float *, float *);
      290 +extern void sincosl(long double, long double *, long double *);
 299  291  
 300  292  #if defined(__MATHERR_ERRNO_DONTCARE)
 301  293  #pragma does_not_read_global_data(sincos, sincosf, sincosl)
 302  294  #endif
 303  295  
 304  296  /* BEGIN adopted by C99 */
 305  297  /*
 306  298   * Functions callable from C, intended to support IEEE arithmetic.
 307  299   */
 308      -extern double copysign __P((double, double));
 309      -extern double scalbn __P((double, int));
      300 +extern double copysign(double, double);
      301 +extern double scalbn(double, int);
 310  302  
 311  303  #if defined(__MATHERR_ERRNO_DONTCARE)
 312  304  #pragma does_not_read_global_data(copysign, scalbn)
 313  305  #pragma does_not_write_global_data(copysign, scalbn)
 314  306  #pragma no_side_effect(copysign, scalbn)
 315  307  #endif
 316  308  /* END adopted by C99 */
 317  309  
 318  310  /*
 319  311   * Reentrant version of gamma & lgamma; passes signgam back by reference
 320  312   * as the second argument; user must allocate space for signgam.
 321  313   */
 322      -extern double gamma_r __P((double, int *));     /* deprecated; use lgamma_r */
 323      -extern double lgamma_r __P((double, int *));
      314 +extern double gamma_r(double, int *);   /* deprecated; use lgamma_r */
      315 +extern double lgamma_r(double, int *);
 324  316  
 325  317  #if defined(__MATHERR_ERRNO_DONTCARE)
 326  318  #pragma does_not_read_global_data(gamma_r, lgamma_r)
 327  319  #endif
 328  320  
 329  321  /* BEGIN adopted by C99 */
 330      -extern float modff __P((float, float *));
      322 +extern float modff(float, float *);
 331  323  
 332  324  #if defined(__MATHERR_ERRNO_DONTCARE)
 333  325  #pragma does_not_read_global_data(modff)
 334  326  #endif
 335  327  /* END adopted by C99 */
 336  328  
 337  329  #if defined(__EXTENSIONS__) || !defined(__cplusplus)
 338  330  #include <floatingpoint.h>
 339  331  #endif
 340  332  #endif  /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) */
↓ open down ↓ 11 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX