Skip to content

Functions from vec3-ext.h and vec4-ext.h can trigger warnings with recent clang #428

Open
@pm4gh

Description

@pm4gh

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
    }

/*!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions