(Trivial) (DragonFly) Some of the core/stdc/math c-library functions had the 'pure' attribute set#2161
Conversation
|
Thanks for your pull request and interest in making D better, @dkgroot! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + druntime#2161" |
|
The pure attribute seems to be scattered around a little here. Why aren't most or even all of these extern c-library math function calls 'pure'? I do not see how any of them could have side-effects. Maybe i am missing something :-) BTW: I followed the GLIBC version and matched the ones that had to 'pure' attribute (for now). |
|
@dkgroot The source for which functions are annotated
|
src/core/stdc/math.d
Outdated
| @@ -3378,25 +3378,25 @@ else version(DragonFlyBSD) | |||
| double cbrt(double x); | |||
There was a problem hiding this comment.
Added pure to the cbrt function... Thanks for checking !
| real fmaxl(real x, real y); | ||
| real fminl(real x, real y); | ||
| pure real fdiml(real x, real y); | ||
| pure real fmaxl(real x, real y); |
src/core/stdc/math.d
Outdated
| real fdiml(real x, real y); | ||
| real fmaxl(real x, real y); | ||
| real fminl(real x, real y); | ||
| pure real fdiml(real x, real y); |
There was a problem hiding this comment.
For non-DragonFlyBSD fdiml isn't marked pure. Same for nexttoward, nextafter.
EDIT: correction
src/core/stdc/math.d
Outdated
| pure real erfl(real x); | ||
| pure real erfcl(real x); | ||
| pure real lgammal(real x); | ||
| pure real tgammal(real x); |
There was a problem hiding this comment.
For non-DragonFlyBSD erf is marked pure but not erfc, lgamma, tgamma.
src/core/stdc/math.d
Outdated
| pure real fabsl(real x); | ||
| pure real hypotl(real x, real y); | ||
| pure real powl(real x, real y); | ||
| pure real sqrtl(real x); |
There was a problem hiding this comment.
For non-DragonFlyBSD cbrt and fabs are marked pure but not hypot, pow, sqrt.
src/core/stdc/math.d
Outdated
| pure real logbl(real x); | ||
| pure real modfl(real x, real *iptr); | ||
| pure real scalbnl(real x, int y); | ||
| pure real scalblnl(real x, c_long y); |
There was a problem hiding this comment.
For non-DragonFlyBSD modf is marked pure but not logb, scalb.
src/core/stdc/math.d
Outdated
| pure real frexpl(real x, int *exp); | ||
| int ilogbl(real x); | ||
| real ldexpl(real x, int exp); | ||
| pure real ldexpl(real x, int exp); |
There was a problem hiding this comment.
For non-DragonFlyBSD frexp is marked pure but not exp, exp2, expm1, ldexp.
| pure real atanhl(real x); | ||
| pure real coshl(real x); | ||
| pure real sinhl(real x); | ||
| pure real tanhl(real x); |
There was a problem hiding this comment.
For non-DragonFlyBSD tanh and asinh are marked pure but not acosh, atanh, cosh, sinh.
src/core/stdc/math.d
Outdated
| pure real acosl(real x); | ||
| pure real asinl(real x); | ||
| pure real atanl(real x); | ||
| pure real atan2l(real x, real y); |
There was a problem hiding this comment.
For non-DragonFlyBSD atan2 is not marked pure
There was a problem hiding this comment.
Thanks for checking all of these. I guess i thought i saw a pattern when making the corrections, which was faulty.
|
@n8sh Thanks got checking ! Much appreciated. |
|
Check whitespace is failing. |
…te needed for DragonFly. Caused trouble compiling phobos since dlang/phobos#6409 Phobos Compile Error: std/math.d(4598): Error: `pure` function `std.math.nearbyint` cannot call impure function `core.stdc.math.nearbyintl`
3b28cb8 to
8a70692
Compare
|
Thanks everyone ! |
Phobos Compile Error:
std/math.d(4598): Error:
purefunctionstd.math.nearbyintcannot call impure functioncore.stdc.math.nearbyintlIssue got apparent when dlang/phobos#6409 was merged.
Note: This fix only references DragonFly specific code