[gjs/mcatanzaro/#357] Fix 32-bit build




commit b81e8ababb5dc81682b32c3b8a7a1b48844a0001
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Oct 21 19:26:57 2020 -0500

    Fix 32-bit build
    
    Problem is that each separate 'if constexpr' block needs to evaluate to
    the same return type. The first block returns GType (long unsigned int),
    but the second block returns uint32_t (unsigned int), and that fails to
    build on i686 because long unsigned int and unsigned int are the same
    size. (On Linux, vanilla ints are always 32-bit, long long ints are
    64-bit, and long ints match the word size, so in C++, GType is 64-bits
    on 64-bit systems, and 32-bits on 32-bit systems.)
    
    Further note that I am assuming C++ here, which is true in this header.
    In C, GType is always 64-bits. That's right, the size of GType differs
    based on what programming language you use, but only on 32-bit systems.
    I guess if there are no explosions in practice, and nobody registers
    more than four billion types per process, it must be OK?
    
    Thanks to Abderrahim for preparing an earlier version of this fix, and
    to both Abderrahim and Jordan for helping me with BuildStream to do an
    i686 build.
    
    Fixes #357

 gi/js-value-inl.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gi/js-value-inl.h b/gi/js-value-inl.h
index 03c0bb19..fe4c2a3c 100644
--- a/gi/js-value-inl.h
+++ b/gi/js-value-inl.h
@@ -52,9 +52,7 @@ constexpr auto get_strict() {
             return gboolean{};
         else
             return;
-    }
-
-    if constexpr (std::is_same_v<T, char32_t>)
+    } else if constexpr (std::is_same_v<T, char32_t>)
         return char32_t{};
     else if constexpr (type_fits<T, int32_t>())
         return int32_t{};


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]