[Mesa-dev] [PATCH] util: Fix Clang trivial destructor check.

Edward O'Callaghan funfunctor at folklore1984.net
Mon Nov 14 11:02:24 UTC 2016


Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 11/14/2016 06:11 PM, Vinson Lee wrote:
> Check for Clang before GCC.
> 
> Clang defines __GNUC__ == 4 and __GNUC_MINOR__ == 2 and matches the GCC
> check but not the GCC version for trivial destructor.
> 
> Fixes: 98ab905af0e0 ("mesa: Define introspection macro to determine
> whether a type is trivially destructible.")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98526
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/util/macros.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/util/macros.h b/src/util/macros.h
> index 0563fa59b595..733bf42cdddd 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -167,12 +167,12 @@ do {                       \
>   * performs no action and all member variables and base classes are
>   * trivially destructible themselves.
>   */
> -#   if defined(__GNUC__)
> -#      if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
> +#   if (defined(__clang__) && defined(__has_feature))
> +#      if __has_feature(has_trivial_destructor)
>  #         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
>  #      endif
> -#   elif (defined(__clang__) && defined(__has_feature))
> -#      if __has_feature(has_trivial_destructor)
> +#   elif defined(__GNUC__)
> +#      if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
>  #         define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
>  #      endif
>  #   elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161114/0bc050a4/attachment.sig>


More information about the mesa-dev mailing list