[glib: 2/7] build: Disable dtrace probes under static analysis



commit 0b4162e71403863cff688128f28082df297f58d8
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Sep 5 13:53:13 2019 +0100

    build: Disable dtrace probes under static analysis
    
    The macros for the probes confuse the static analyser, and are often
    called with arguments which the analyser things shouldn’t be used any
    more (for example, the address of a block of memory which has just been
    freed).
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #1767

 gio/gio_trace.h         | 4 +++-
 glib/glib_trace.h       | 4 +++-
 gobject/gobject_trace.h | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gio/gio_trace.h b/gio/gio_trace.h
index 47d4eacb2..addb70ae4 100644
--- a/gio/gio_trace.h
+++ b/gio/gio_trace.h
@@ -25,7 +25,9 @@
 #error "config.h must be included prior to gio_trace.h"
 #endif
 
-#ifdef HAVE_DTRACE
+/* Ignore probes when doing static analysis, as they do weird things which
+ * confuses the analyser. */
+#if defined(HAVE_DTRACE) && !defined(__clang_analyzer__)
 
 /* include the generated probes header and put markers in code */
 #include "gio_probes.h"
diff --git a/glib/glib_trace.h b/glib/glib_trace.h
index 1876738cf..fdb8f8c46 100644
--- a/glib/glib_trace.h
+++ b/glib/glib_trace.h
@@ -25,7 +25,9 @@
 #error "config.h must be included prior to glib_trace.h"
 #endif
 
-#ifdef HAVE_DTRACE
+/* Ignore probes when doing static analysis, as they do weird things which
+ * confuses the analyser. */
+#if defined(HAVE_DTRACE) && !defined(__clang_analyzer__)
 
 /* include the generated probes header and put markers in code */
 #include "glib_probes.h"
diff --git a/gobject/gobject_trace.h b/gobject/gobject_trace.h
index 30ef2fb5b..261fdac07 100644
--- a/gobject/gobject_trace.h
+++ b/gobject/gobject_trace.h
@@ -25,7 +25,9 @@
 #error "config.h must be included prior to gobject_trace.h"
 #endif
 
-#ifdef HAVE_DTRACE
+/* Ignore probes when doing static analysis, as they do weird things which
+ * confuses the analyser. */
+#if defined(HAVE_DTRACE) && !defined(__clang_analyzer__)
 
 /* include the generated probes header and put markers in code */
 #include "gobject_probes.h"


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