]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
g-i: Fix a couple of C compiler warnings
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 28 Sep 2020 10:44:12 +0000 (12:44 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 29 Sep 2020 10:26:17 +0000 (12:26 +0200)
gobject-introspection/gidlparser.c
gobject-introspection/gidlwriter.c
gobject-introspection/scanner.c
gobject-introspection/scannerparser.y

index 81494414fb79447982ef2089d633f5d8de6789ba..900c7ccce9ffae4c8c9d507a9840ec2f7543cd06 100644 (file)
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include "gidlmodule.h"
 #include "gidlnode.h"
+#include "gidlparser.h"
 #include "gmetadata.h"
 
 typedef enum
index 32c86f73d43cb130cca5af5d4384e1e94754f531..60080fb183c2f7c59b77cf73d454244281494d44 100644 (file)
@@ -26,6 +26,7 @@
 #include <glib.h>
 #include "scanner.h"
 #include "gidlnode.h"
+#include "gidlwriter.h"
 
 typedef struct {
   int indent;
index 8be5d5422bcf7a76fe5f5a8c2c04df2f849fa821..58133f968616469ad63a778aa21ae5f0187cd7d6 100644 (file)
@@ -775,13 +775,14 @@ g_igenerator_process_struct_typedef (GIGenerator * igenerator, CSymbol * sym)
               member_l = member_l->next)
            {
              CSymbol *member = member_l->data;
+             GIdlNodeField *gifield;
              /* ignore private / reserved members */
              if (member->ident[0] == '_'
                  || g_str_has_prefix (member->ident, "priv"))
                {
                  continue;
                }
-             GIdlNodeField *gifield =
+             gifield =
                (GIdlNodeField *) g_idl_node_new (G_IDL_NODE_FIELD);
              node->members = g_list_append (node->members, gifield);
              gifield->node.name = member->ident;
@@ -943,8 +944,9 @@ g_igenerator_process_union_typedef (GIGenerator * igenerator, CSymbol * sym)
   
   if (union_type->child_list == NULL)
     {
+      CSymbol *union_symbol;
       g_assert (union_type->name != NULL);
-      CSymbol *union_symbol =
+      union_symbol =
        g_hash_table_lookup (igenerator->struct_or_union_or_enum_table,
                             union_type->name);
       if (union_symbol != NULL)
@@ -960,9 +962,10 @@ g_igenerator_process_union_typedef (GIGenerator * igenerator, CSymbol * sym)
   type = g_hash_table_lookup (igenerator->type_map, sym->ident);
   if (type != NULL)
     {
-      g_assert (type->type == G_IDL_NODE_BOXED);
-      GIdlNodeBoxed *node = (GIdlNodeBoxed *) type;
+      GIdlNodeBoxed *node;
       GList *member_l;
+      g_assert (type->type == G_IDL_NODE_BOXED);
+      node = (GIdlNodeBoxed *) type;
       for (member_l = union_type->child_list; member_l != NULL;
           member_l = member_l->next)
        {
@@ -1249,7 +1252,7 @@ g_igenerator_is_typedef (GIGenerator * igenerator, const char *name)
   return b;
 }
 
-void
+static void
 g_igenerator_generate (GIGenerator * igenerator,
                       const gchar * filename,
                       GList *libraries)
@@ -1330,12 +1333,12 @@ g_igenerator_parse_macros (GIGenerator * igenerator)
 {
   GError *error = NULL;
   char *tmp_name = NULL;
+  GList *l;
   FILE *fmacros =
     fdopen (g_file_open_tmp ("gen-introspect-XXXXXX.h", &tmp_name, &error),
            "w+");
   g_unlink (tmp_name);
 
-  GList *l;
   for (l = igenerator->filenames; l != NULL; l = l->next)
     {
       FILE *f = fopen (l->data, "r");
index 2042bdc56259e8823b77214e5eba8be2294b1b60..0c3a88ca238d00f79d0c16f08e81cd50942cb63e 100644 (file)
@@ -77,7 +77,7 @@ csymbol_get_const_boolean (CSymbol * symbol)
   return (symbol->const_int_set && symbol->const_int) || symbol->const_string;
 }
 
-CType *
+static CType *
 ctype_new (CTypeType type)
 {
   CType *t = g_new0 (CType, 1);
@@ -85,13 +85,13 @@ ctype_new (CTypeType type)
   return t;
 }
 
-CType *
+static CType *
 ctype_copy (CType * type)
 {
   return g_memdup (type, sizeof (CType));
 }
 
-CType *
+static CType *
 cbasic_type_new (const char *name)
 {
   CType *basic_type = ctype_new (CTYPE_BASIC_TYPE);
@@ -99,7 +99,7 @@ cbasic_type_new (const char *name)
   return basic_type;
 }
 
-CType *
+static CType *
 ctypedef_new (const char *name)
 {
   CType *typedef_ = ctype_new (CTYPE_TYPEDEF);
@@ -107,7 +107,7 @@ ctypedef_new (const char *name)
   return typedef_;
 }
 
-CType *
+static CType *
 cstruct_new (const char *name)
 {
   CType *struct_ = ctype_new (CTYPE_STRUCT);
@@ -115,7 +115,7 @@ cstruct_new (const char *name)
   return struct_;
 }
 
-CType *
+static CType *
 cunion_new (const char *name)
 {
   CType *union_ = ctype_new (CTYPE_UNION);
@@ -123,7 +123,7 @@ cunion_new (const char *name)
   return union_;
 }
 
-CType *
+static CType *
 cenum_new (const char *name)
 {
   CType *enum_ = ctype_new (CTYPE_ENUM);
@@ -131,7 +131,7 @@ cenum_new (const char *name)
   return enum_;
 }
 
-CType *
+static CType *
 cpointer_new (CType * base_type)
 {
   CType *pointer = ctype_new (CTYPE_POINTER);
@@ -139,14 +139,14 @@ cpointer_new (CType * base_type)
   return pointer;
 }
 
-CType *
+static CType *
 carray_new (void)
 {
   CType *array = ctype_new (CTYPE_ARRAY);
   return array;
 }
 
-CType *
+static CType *
 cfunction_new (void)
 {
   CType *func = ctype_new (CTYPE_FUNCTION);
@@ -802,11 +802,13 @@ type_specifier
 struct_or_union_specifier
        : struct_or_union identifier_or_typedef_name '{' struct_declaration_list '}'
          {
+               CSymbol *sym;
+
                $$ = $1;
                $$->name = $2;
                $$->child_list = $4;
 
-               CSymbol *sym = csymbol_new (CSYMBOL_TYPE_INVALID);
+               sym = csymbol_new (CSYMBOL_TYPE_INVALID);
                if ($$->type == CTYPE_STRUCT) {
                        sym->type = CSYMBOL_TYPE_STRUCT;
                } else if ($$->type == CTYPE_UNION) {