[glib] gmacros: Only set G_ANALYZER_ANALYZING to 1 when clang static analyzer is in use



commit d7a1d890c109c8610333f938dee15e5d938ee8d8
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Thu Jan 1 13:28:21 2015 +0800

    gmacros: Only set G_ANALYZER_ANALYZING to 1 when clang static analyzer is in use
    
    We set G_ANALYZER_ANALYZING to 1 when clang supporting static analyzing before,
    but this will cause compilation error when -Werror=return-type is used and the
    static analyzer is not in use because g_error static function only has
    __attribute__((analyzer_noreturn)), which is useless for normal compilation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741901

 glib/gmacros.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 9cc314e..a7a250e 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -164,7 +164,7 @@
 #endif  /* !__GNUC__ */
 #endif  /* !G_DISABLE_DEPRECATED */
 
-#if __has_feature(attribute_analyzer_noreturn)
+#if __has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__)
 #define G_ANALYZER_ANALYZING 1
 #define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
 #else


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