Marking more functions as pure / const

Eitan Adler lists at eitanadler.com
Tue Feb 20 03:01:34 UTC 2018


There are a few functions that are explicitly marked as "not pure2"
(const) but can be marked as pure. The difference between them is
"does the function /read/ from global memory?".

Is there anything wrong with this diff?  Not touched are all the other
functions which all seem to at least be __pure if not __pure2.


Index: lib/msun/src/math.h
===================================================================
--- lib/msun/src/math.h (revision 329611)
+++ lib/msun/src/math.h (working copy)
@@ -242,11 +242,11 @@ double sinh(double);
 double tanh(double);

 double exp(double);
-double frexp(double, int *); /* fundamentally !__pure2 */
+double frexp(double, int *) __pure; /* fundamentally !__pure2 */
 double ldexp(double, int);
 double log(double);
 double log10(double);
-double modf(double, double *); /* fundamentally !__pure2 */
+double modf(double, double *) __pure; /* fundamentally !__pure2 */

 double pow(double, double);
 double sqrt(double);
@@ -354,7 +354,7 @@ float tanhf(float);
 float exp2f(float);
 float expf(float);
 float expm1f(float);
-float frexpf(float, int *); /* fundamentally !__pure2 */
+float frexpf(float, int *) __pure; /* fundamentally !__pure2 */
 int ilogbf(float) __pure2;
 float ldexpf(float, int);
 float log10f(float);
@@ -361,7 +361,7 @@ float log10f(float);
 float log1pf(float);
 float log2f(float);
 float logf(float);
-float modff(float, float *); /* fundamentally !__pure2 */
+float modff(float, float *) __pure; /* fundamentally !__pure2 */

 float powf(float, float);
 float sqrtf(float);
@@ -461,7 +461,7 @@ long double fmal(long double, long double, long do
 long double fmaxl(long double, long double) __pure2;
 long double fminl(long double, long double) __pure2;
 long double fmodl(long double, long double);
-long double frexpl(long double, int *); /* fundamentally !__pure2 */
+long double frexpl(long double, int *) __pure; /* fundamentally !__pure2 */
 long double hypotl(long double, long double);
 int ilogbl(long double) __pure2;
 long double ldexpl(long double, int);
@@ -475,7 +475,7 @@ long double logbl(long double);
 long double logl(long double);
 long lrintl(long double);
 long lroundl(long double);
-long double modfl(long double, long double *); /* fundamentally !__pure2 */
+long double modfl(long double, long double *) __pure; /*
fundamentally !__pure2 */
 long double nanl(const char *) __pure2;
 long double nearbyintl(long double);
 long double nextafterl(long double, long double);


-- 
Eitan Adler


More information about the freebsd-numerics mailing list