From 2bc73d7281383c42fa32009eed639a4f4cc274c5 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 9 Jul 2019 18:17:02 +0800 Subject: [PATCH] glib/gmacros.h: Check for __clang__ for g_autoptr clang-cl does support __attribute__((cleanup)), which is what is used for the g_auto* macros, but neither it, nor clang.exe defines __GNUC__ when they are used in a MSVC cmd.exe environment. It does, however, define __clang__. So, check for the presence of the __clang__ macro to enable g_autoptr as well, so that we can build things with MSVC builds that make use of g_autoptr via pretending to be MSVC by using clang-cl. --- glib/gmacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gmacros.h b/glib/gmacros.h index 2764d9552..5ca7beb38 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -1021,7 +1021,7 @@ #ifndef __GI_SCANNER__ -#ifdef __GNUC__ +#if defined (__GNUC__) || defined (__clang__) /* these macros are private */ #define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName