Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 110367d8 authored by Krzysztof Kosiński's avatar Krzysztof Kosiński
Browse files

Fix -Wdeprecated-literal-operator in quat.h.

This also removes an unnecessary macro and fixes a warning
about unbalanced pragmas that appears when opening the file
in a clangd-enabled IDE.

Fix: 427542076
Test: presubmit
Flag: EXEMPT no runtime behavior changes
Change-Id: I137758cc4869afe898803d3d014c63f09714dd90
parent 94ebe6f1
Loading
Loading
Loading
Loading
+21 −26
Original line number Diff line number Diff line
@@ -24,19 +24,15 @@
#include <stdint.h>
#include <sys/types.h>

#ifndef PURE
#define PURE __attribute__((pure))
#endif

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wnested-anon-types"

namespace android {
// -------------------------------------------------------------------------------------

namespace details {

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wnested-anon-types"

template <typename T>
class TQuaternion : public TVecAddOperators<TQuaternion, T>,
                    public TVecUnaryOperators<TQuaternion, T>,
@@ -130,11 +126,14 @@ public:

    // constructs a quaternion from an axis and angle
    template <typename A, typename B>
    constexpr static TQuaternion PURE fromAxisAngle(const TVec3<A>& axis, B angle) {
    constexpr static TQuaternion __attribute__((pure)) fromAxisAngle(const TVec3<A>& axis,
                                                                     B angle) {
        return TQuaternion(std::sin(angle * 0.5) * normalize(axis), std::cos(angle * 0.5));
    }
};

#pragma clang diagnostic pop

}  // namespace details

// ----------------------------------------------------------------------------------------
@@ -188,7 +187,3 @@ constexpr inline quatd operator"" _kd(unsigned long long v) { // NOLINT
}  // namespace android

TVECHELPERS_STD_HASH(android::details::TQuaternion);

#pragma clang diagnostic pop

#undef PURE