[Mesa-dev] [PATCH] Android: enable noreturn and returns_nonnull attributes
Rob Herring
robh at kernel.org
Tue Dec 5 14:57:50 UTC 2017
On Tue, Dec 5, 2017 at 5:56 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 5 December 2017 at 02:21, Rob Herring <robh at kernel.org> wrote:
>> Commit 94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers") broke
>> Android builds which have -Werror enabled with the following errors:
>>
>> external/mesa3d/src/compiler/spirv/spirv_to_nir.c:272:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
>> external/mesa3d/src/compiler/spirv/spirv_to_nir.c:810:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
>> ...
>>
>> The problem is the noreturn attribute is not enabled and we to define
>> HAVE_FUNC_ATTRIBUTE_NORETURN.
>>
>> Auditing src/util/macros.h, we're also missing
>> HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL, so add it too.
>>
>> Fixes: 94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers")
>> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
>> Signed-off-by: Rob Herring <robh at kernel.org>
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
>
> The following shows the macros not set on Android. Feel free to check
> if they're supported and toggle them on.
I did this, but did another check of it.
> $ for i in `git grep "if.*def.*HAVE_FUNC_ATTRIBUTE_" origin/master --
> | grep -o "HAVE_FUNC_[A-Z_]*" | sort -u`; do git grep $i
> origin/master | grep
> -qi android || echo missing $i; done
> missing HAVE_FUNC_ATTRIBUTE_CONST
> missing HAVE_FUNC_ATTRIBUTE_MALLOC
> missing HAVE_FUNC_ATTRIBUTE_NORETURN
> missing HAVE_FUNC_ATTRIBUTE_PURE
> missing HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
> missing HAVE_FUNC_ATTRIBUTE_VISIBILITY
> missing HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
At least according to documentation for clang, this is the only other
one that is supported. So I turned it on too and pushed the commit.
> missing HAVE_FUNC_ATTRIBUTE_WEAK
>
> -Emil
More information about the mesa-dev
mailing list