cglm
cglm copied to clipboard
Functions from vec3-ext.h and vec4-ext.h can trigger warnings with recent clang
The glm_vec3_isnan, glm_vec3_isinf, glm_vec4_isnan and glm_vec4_isinf sunctions cause compiler warnings with recent clang versions and the -ffast-math compiler flag: "use of NaN is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]" or "use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]"
Changes similar to the following would work around this.
@@ -172,7 +172,12 @@ glm_vec3_min(vec3 v) { CGLM_INLINE bool glm_vec3_isnan(vec3 v) { +#if !defined( FAST_MATH) return isnan(v[0]) || isnan(v[1]) || isnan(v[2]); +#else
- (void)v;
- return 0; +#endif }
/*!
Hi @pm4gh,
Sorry for the delay and thanks for reporting this and providing a solution.
https://github.com/recp/cglm/commit/c12f318fabf14853174419f3892654612186c5c7 should suppress the warnings.