Closed citral23 closed 3 years ago
wscript already has check on valid tgmath.h implementation: https://github.com/FWGS/xash3d-fwgs/blob/master/wscript#L341
Probably, need check for fabs yet.
Indeed, waf configure said Checking if tgmath.h is usable : yes
Note that hlsdk-xash3d compiles with tgmath enabled without errors
I fixed that @citral23, make a new issue if there will be something wrong.
The old xash3d code compiled fine for mipsel (using the GCW0 toolchain, so an outdated 4.9.1 gcc/g++) with its mathlib, but the new xash3d-fwgs requires #include to be disabled in xash3d_mathlib.h or I get the following errors :
../public/xash3d_mathlib.c: In function ‘FloatToHalf’: ../public/xash3d_mathlib.c:76:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] unsigned int i = ((unsigned int )&v); ^ ../public/xash3d_mathlib.c: In function ‘HalfToFloat’: ../public/xash3d_mathlib.c:118:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((float )&f); ^ ../public/xash3d_mathlib.c: In function ‘rsqrt’: ../public/xash3d_mathlib.c:299:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] i = (int )&number; // evil floating point bit level hacking ^ ../public/xash3d_mathlib.c:301:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] y = (float )&i; ^ In file included from ../public/xash3d_mathlib.h:21:0, from ../public/xash3d_mathlib.c:19: ../public/xash3d_mathlib.c: In function ‘VectorsAngles’: ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘__tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘__tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c:467:11: error: assignment of read-only variable ‘tgmres’ pitch = -asin( forward[2] ); ^ ../public/xash3d_mathlib.c: In function ‘RadiusFromBounds’: ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:15: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:33: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:51: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘__tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c:617:69: error: assignment of read-only variable ‘tgmres’ corner[i] = fabs( mins[i] ) > fabs( maxs[i] ) ? fabs( mins[i] ) : fabs( maxs[i] ); ^ ../public/xash3d_mathlib.c: In function ‘QuaternionAngle’: ../public/xash3d_mathlib.c:664:2: warning: passing argument 1 of ‘Matrix3x4_AnglesFromMatrix’ from incompatible pointer type Matrix3x4_AnglesFromMatrix( mat, angles ); ^ In file included from ../public/xash3d_mathlib.c:19:0: ../public/xash3d_mathlib.h:182:6: note: expected ‘const vec_t ()[4]’ but argument is of type ‘vec_t ()[4]’ void Matrix3x4_AnglesFromMatrix( const matrix3x4 in, vec3_t out ); ^
../public/crclib.c: In function ‘MD5Final’: ../public/crclib.c:322:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint )ctx->in)[14] = ctx->bits[0]; ^ ../public/crclib.c:323:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint )ctx->in)[15] = ctx->bits[1]; ^