[gobject-introspection] Annotate possibly unused variable



commit 334877eccf62fde389c9dedd6a751bcdb4345f15
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Mar 10 15:33:06 2018 +0000

    Annotate possibly unused variable
    
    When using the NEW_CLASS macro, we're also declaring a static constant
    that we might end up using later.
    
    GCC will complain if we're not using the declared variable, so we should
    annotate it with G_GNUC_UNUSED. If we end up using the variable, the
    compiler will ignore the annotation; if we don't, we won't be getting a
    compiler warning when we don't use it.

 giscanner/giscannermodule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index 77de82d6..9148960f 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -56,7 +56,7 @@
 _GI_EXTERN MOD_INIT(_giscanner);
 
 #define NEW_CLASS(ctype, name, cname, num_methods)           \
-static const PyMethodDef _Py##cname##_methods[num_methods];    \
+static const PyMethodDef _Py##cname##_methods[num_methods] G_GNUC_UNUSED;    \
 PyTypeObject Py##cname##_Type = {             \
     PyVarObject_HEAD_INIT(NULL, 0)            \
     "scanner." name,                          \


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