[Mesa-dev] [PATCH mesa] vma/tests: cast away implementation detail of using strtoul()

Eric Anholt eric at anholt.net
Wed Jun 6 17:31:38 UTC 2018


Eric Engestrom <eric.engestrom at intel.com> writes:

> On MacOS, the build fails because of a compiler complaint about
> a downcast:
>
>   vma_random_test.cpp:239:18: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'uint_fast32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
>      random_test r{seed};
>                    ^~~~
>   vma_random_test.cpp:239:18: note: insert an explicit cast to silence this issue
>      random_test r{seed};
>                    ^~~~
>                    static_cast<uint_fast32_t>( )
>
> Let's take the compiler's suggestion, as we only needed a long here to
> use strtoul().
>
> Cc: Scott D Phillips <scott.d.phillips at intel.com>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>

This commit seems to have resolved the issue:

commit 08535dd8860951ce4572cd2590e417a1f3d96b3d
Author: Scott D Phillips <scott.d.phillips at intel.com>
Date:   Tue Jun 5 09:29:43 2018 -0700

    util/tests/vma: Fix warning c++11-narrowing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180606/1731e950/attachment.sig>


More information about the mesa-dev mailing list