[glib/gmacros-h-support-clang-cl: 1/2] glib/gmacros.h: Check for __clang__ for g_autoptr



commit 2bc73d7281383c42fa32009eed639a4f4cc274c5
Author: Chun-wei Fan <fanc999 yahoo com tw>
Date:   Tue Jul 9 18:17:02 2019 +0800

    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


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