Imported Upstream version 1.52.1 10/130610/1 upstream/1.52.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 23 May 2017 06:13:46 +0000 (15:13 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 23 May 2017 06:13:50 +0000 (15:13 +0900)
Change-Id: Id9e0f1a902be9dcf78ae25a60fe87f14b66be73a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
12 files changed:
configure.ac
gir/gio-2.0.c
gir/glib-2.0.c
gir/gmodule-2.0.c
giscanner/ccompiler.py
giscanner/dumper.py
giscanner/girwriter.py
giscanner/transformer.py
tests/gimarshallingtests.c
tests/gimarshallingtests.h
tests/scanner/Regress-1.0-expected.gir
tests/scanner/test_transformer.py

index 77287bc..0dad4a0 100644 (file)
@@ -3,8 +3,8 @@
 
 dnl the gi version number
 m4_define(gi_major_version, 1)
-m4_define(gi_minor_version, 51)
-m4_define(gi_micro_version, 5)
+m4_define(gi_minor_version, 52)
+m4_define(gi_micro_version, 1)
 m4_define(gi_version, gi_major_version.gi_minor_version.gi_micro_version)
 
 AC_PREREQ([2.63])
@@ -128,7 +128,7 @@ GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
 AC_SUBST(GIR_DIR)
 AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
 
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.51.5])
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.52.1])
 PKG_CHECK_MODULES(GOBJECT, [gobject-2.0])
 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
 PKG_CHECK_MODULES(GIO, [gio-2.0])
index 105a47c..7852855 100644 (file)
  *
  * Checks if two #GAppInfos are equal.
  *
+ * Note that the check <em>may not</em> compare each individual field, and
+ * only does an identity check. In case detecting changes in the contents
+ * is needed, program code must additionally compare relevant fields.
+ *
  * Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
  */
 
  * @cancellable: (nullable): a #GCancellable, or %NULL
  * @error: (nullable): a #GError, or %NULL
  *
- * Verify's a certificate chain after looking up and adding any missing
- * certificates to the chain.
+ * Determines the validity of a certificate chain after looking up and
+ * adding any missing certificates to the chain.
  *
  * @chain is a chain of #GTlsCertificate objects each pointing to the next
  * certificate in the chain by its %issuer property. The chain may initially
  * Currently there are no @flags, and %G_TLS_DATABASE_VERIFY_NONE should be
  * used.
  *
+ * If @chain is found to be valid, then the return value will be 0. If
+ * @chain is found to be invalid, then the return value will indicate
+ * the problems found. If the function is unable to determine whether
+ * @chain is valid or not (eg, because @cancellable is triggered
+ * before it completes) then the return value will be
+ * %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set
+ * accordingly. @error is not set when @chain is successfully analyzed
+ * but found to be invalid.
+ *
  * This function can block, use g_tls_database_verify_chain_async() to perform
  * the verification operation asynchronously.
  *
  * @callback: callback to call when the operation completes
  * @user_data: the data to pass to the callback function
  *
- * Asynchronously verify's a certificate chain after looking up and adding
- * any missing certificates to the chain. See g_tls_database_verify_chain()
- * for more information.
+ * Asynchronously determines the validity of a certificate chain after
+ * looking up and adding any missing certificates to the chain. See
+ * g_tls_database_verify_chain() for more information.
  *
  * Since: 2.30
  */
  * @error: a #GError pointer, or %NULL
  *
  * Finish an asynchronous verify chain operation. See
- * g_tls_database_verify_chain() for more information. *
+ * g_tls_database_verify_chain() for more information.
+ *
+ * If @chain is found to be valid, then the return value will be 0. If
+ * @chain is found to be invalid, then the return value will indicate
+ * the problems found. If the function is unable to determine whether
+ * @chain is valid or not (eg, because @cancellable is triggered
+ * before it completes) then the return value will be
+ * %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set
+ * accordingly. @error is not set when @chain is successfully analyzed
+ * but found to be invalid.
  *
  * Returns: the appropriate #GTlsCertificateFlags which represents the
  * result of verification.
index c900020..bd277b8 100644 (file)
  * be written to it. It will need up to 4 bytes, or up to 5 bytes if
  * line-breaking is enabled.
  *
+ * The @out array will not be automatically nul-terminated.
+ *
  * Returns: The number of bytes of output that was written
  * Since: 2.12
  */
  * and g_str_equal() functions are provided for the most common types
  * of keys. If @key_equal_func is %NULL, keys are compared directly in
  * a similar fashion to g_direct_equal(), but without the overhead of
- * a function call.
+ * a function call. @key_equal_func is called with the key from the hash table
+ * as its first parameter, and the user-provided key to check against as
+ * its second.
  *
  * Returns: a new #GHashTable
  */
  * recursively remove further items from the hash table. This is only
  * permissible if the application still holds a reference to the hash table.
  * This means that you may need to ensure that the hash table is empty by
- * calling g_hash_table_remove_all before releasing the last reference using
+ * calling g_hash_table_remove_all() before releasing the last reference using
  * g_hash_table_unref().
  *
  * Returns: a new #GHashTable
  * }
  * ]|
  *
+ * Calls to this function from a thread other than the one acquired by the
+ * #GMainContext the #GSource is attached to are typically redundant, as the
+ * source could be destroyed immediately after this function returns. However,
+ * once a source is destroyed it cannot be un-destroyed, so this function can be
+ * used for opportunistic checks from any thread.
+ *
  * Returns: %TRUE if the source has been destroyed
  * Since: 2.12
  */
  * for both sources is reached during the same main context iteration
  * then the order of dispatch is undefined.
  *
+ * It is a no-op to call this function on a #GSource which has already been
+ * destroyed with g_source_destroy().
+ *
  * This API is only intended to be used by implementations of #GSource.
  * Do not call this API on a #GSource that you did not create.
  *
 /**
  * g_utf8_get_char_validated:
  * @p: a pointer to Unicode character encoded as UTF-8
- * @max_len: the maximum number of bytes to read, or -1, for no maximum or
- *     if @p is nul-terminated
+ * @max_len: the maximum number of bytes to read, or -1 if @p is nul-terminated
  *
  * Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
  * This function checks for incomplete characters, for invalid characters
  * - %G_VARIANT_TYPE_DOUBLE: #gdouble
  *
  * For example, if calling this function for an array of 32-bit integers,
- * you might say sizeof(gint32). This value isn't used except for the purpose
+ * you might say `sizeof(gint32)`. This value isn't used except for the purpose
  * of a double-check that the form of the serialised data matches the caller's
  * expectation.
  *
- * @n_elements, which must be non-%NULL is set equal to the number of
+ * @n_elements, which must be non-%NULL, is set equal to the number of
  * items in the array.
  *
  * Returns: (array length=n_elements) (transfer none): a pointer to
index 145d477..a57ce31 100644 (file)
 /**
  * G_MODULE_EXPORT:
  *
- * Used to declare functions exported by modules. This is a no-op on Linux
- * and Unices, but when compiling for Windows, it marks a symbol to be
- * exported from the library or executable being built.
+ * Used to declare functions exported by libraries or modules.
+ *
+ * When compiling for Windows, it marks the symbol as `dllexport`.
+ *
+ * When compiling for Linux and Unices, it marks the symbol as having `default`
+ * visibility. This is no-op unless the code is being compiled with a
+ * non-default
+ * [visibility flag](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fvisibility-1260)
+ * such as `hidden`.
  */
 
 
index 11bc9fc..7c1895d 100644 (file)
@@ -19,6 +19,7 @@
 #
 
 import os
+import shlex
 import subprocess
 import tempfile
 
@@ -213,7 +214,7 @@ class CCompiler(object):
             # This is to handle the case where macros are defined in CFLAGS
             cflags = os.environ.get('CFLAGS')
             if cflags:
-                for i, cflag in enumerate(cflags.split()):
+                for i, cflag in enumerate(shlex.split(cflags)):
                     if cflag.startswith('-D'):
                         stridx = cflag.find('=')
                         if stridx > -1:
index 9077d20..793177b 100644 (file)
@@ -26,6 +26,7 @@ from __future__ import unicode_literals
 
 import os
 import sys
+import shlex
 import subprocess
 import shutil
 import tempfile
@@ -232,15 +233,10 @@ class DumpCompiler(object):
             # MSVC Builds use the INCLUDE, LIB envvars,
             # which are automatically picked up during
             # compilation and linking
-            cppflags = os.environ.get('CPPFLAGS', '')
-            for cppflag in cppflags.split():
+            for cppflag in shlex.split(os.environ.get('CPPFLAGS', '')):
                 args.append(cppflag)
-            cflags = os.environ.get('CFLAGS', '')
-            for cflag in cflags.split():
+            for cflag in shlex.split(os.environ.get('CFLAGS', '')):
                 args.append(cflag)
-            ldflags = os.environ.get('LDFLAGS', '')
-            for ldflag in ldflags.split():
-                args.append(ldflag)
 
         # Make sure to list the library to be introspected first since it's
         # likely to be uninstalled yet and we want the uninstalled RPATHs have
@@ -269,6 +265,10 @@ class DumpCompiler(object):
                                                    libtool,
                                                    self._options.libraries)
 
+        if not self._compiler.check_is_msvc():
+            for ldflag in shlex.split(os.environ.get('LDFLAGS', '')):
+                args.append(ldflag)
+
         if not libtool:
             # non-libtool: prepare distutils for linking the introspection
             # dumper program...
index f637376..4bef1ea 100644 (file)
@@ -276,7 +276,7 @@ class GIRWriter(XMLWriter):
         assert isinstance(ntype, ast.Type), ntype
         attrs = []
         if ntype.ctype:
-            attrs.append(('c:type', ntype.ctype))
+            attrs.append(('c:type', ntype.complete_ctype or ntype.ctype))
         if isinstance(ntype, ast.Array):
             if ntype.array_type != ast.Array.C:
                 attrs.insert(0, ('name', ntype.array_type))
index a1ea343..81b4d0a 100644 (file)
@@ -613,12 +613,7 @@ raise ValueError."""
                        CTYPE_BASIC_TYPE,
                        CTYPE_VOID):
             name = self.strip_identifier(symbol.ident)
-            if symbol.base_type.name:
-                complete_ctype = self._create_complete_source_type(symbol.base_type)
-                target = self.create_type_from_ctype_string(symbol.base_type.name,
-                                                            complete_ctype=complete_ctype)
-            else:
-                target = ast.TYPE_ANY
+            target = self._create_type_from_base(symbol.base_type)
             if name in ast.type_names:
                 return None
             # https://bugzilla.gnome.org/show_bug.cgi?id=755882
index 568492c..40ba573 100644 (file)
@@ -5351,7 +5351,10 @@ enum
   SOME_BOXED_STRUCT_PROPERTY,
   SOME_VARIANT_PROPERTY,
   SOME_BOXED_GLIST_PROPERTY,
+  SOME_GVALUE_PROPERTY,
   SOME_OBJECT_PROPERTY,
+  SOME_FLAGS_PROPERTY,
+  SOME_ENUM_PROPERTY,
 };
 
 G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
@@ -5371,6 +5374,11 @@ gi_marshalling_tests_properties_object_finalize (GObject *obj)
     self->some_strv = NULL;
   }
 
+  if (self->some_gvalue) {
+    g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
+    self->some_gvalue = NULL;
+  }
+
   G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
 }
 
@@ -5424,12 +5432,21 @@ gi_marshalling_tests_properties_object_get_property (GObject *object,
     case SOME_BOXED_GLIST_PROPERTY:
       g_value_set_boxed (value, self->some_boxed_glist);
       break;
+    case SOME_GVALUE_PROPERTY:
+      g_value_set_boxed (value, self->some_gvalue);
+      break;
     case SOME_VARIANT_PROPERTY:
       g_value_set_variant (value, self->some_variant);
       break;
     case SOME_OBJECT_PROPERTY:
       g_value_set_object (value, self->some_object);
       break;
+    case SOME_FLAGS_PROPERTY:
+      g_value_set_flags (value, self->some_flags);
+      break;
+    case SOME_ENUM_PROPERTY:
+      g_value_set_enum (value, self->some_enum);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -5489,6 +5506,11 @@ gi_marshalling_tests_properties_object_set_property (GObject *object,
       g_list_free (self->some_boxed_glist);
       self->some_boxed_glist = g_list_copy (g_value_get_boxed (value));
       break;
+    case SOME_GVALUE_PROPERTY:
+      if (self->some_gvalue)
+        g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
+      self->some_gvalue = g_value_dup_boxed (value);
+      break;
     case SOME_VARIANT_PROPERTY:
       if (self->some_variant != NULL)
         g_variant_unref (self->some_variant);
@@ -5501,6 +5523,12 @@ gi_marshalling_tests_properties_object_set_property (GObject *object,
         g_object_unref (self->some_object);
       self->some_object = g_value_dup_object (value);
       break;
+    case SOME_FLAGS_PROPERTY:
+      self->some_flags = g_value_get_flags (value);
+      break;
+    case SOME_ENUM_PROPERTY:
+      self->some_enum = g_value_get_enum (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -5617,6 +5645,13 @@ static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTest
                                                        gi_marshalling_tests_boxed_glist_get_type
                                                        (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
 
+  g_object_class_install_property (object_class, SOME_GVALUE_PROPERTY,
+                                   g_param_spec_boxed ("some-gvalue",
+                                                       "some-gvalue",
+                                                       "some-gvalue",
+                                                       G_TYPE_VALUE,
+                                                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
   g_object_class_install_property (object_class, SOME_VARIANT_PROPERTY,
                                    g_param_spec_variant ("some-variant",
                                                          "some-variant",
@@ -5631,6 +5666,22 @@ static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTest
                                                         "some-object",
                                                         G_TYPE_OBJECT,
                                                         G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property (object_class, SOME_FLAGS_PROPERTY,
+                                   g_param_spec_flags ("some-flags",
+                                                       "some-flags",
+                                                       "some-flags",
+                                                       GI_MARSHALLING_TESTS_TYPE_FLAGS,
+                                                       GI_MARSHALLING_TESTS_FLAGS_VALUE1,
+                                                       G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property (object_class, SOME_ENUM_PROPERTY,
+                                   g_param_spec_enum ("some-enum",
+                                                      "some-enum",
+                                                      "some-enum",
+                                                      GI_MARSHALLING_TESTS_TYPE_GENUM,
+                                                      GI_MARSHALLING_TESTS_GENUM_VALUE1,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
 }
 
 GIMarshallingTestsPropertiesObject *
index cd1aac3..0c59952 100644 (file)
@@ -1970,8 +1970,11 @@ struct _GIMarshallingTestsPropertiesObject {
     gchar **some_strv;
     GIMarshallingTestsBoxedStruct* some_boxed_struct;
     GList* some_boxed_glist;
+    GValue *some_gvalue;
     GVariant *some_variant;
     GObject *some_object;
+    GIMarshallingTestsFlags some_flags;
+    GIMarshallingTestsGEnum some_enum;
 };
 
 struct _GIMarshallingTestsPropertiesObjectClass {
index 3a80bed..a9f5972 100644 (file)
@@ -23,7 +23,7 @@ and/or use gtk-doc annotations.  -->
       <type name="gpointer" c:type="gpointer"/>
     </alias>
     <alias name="FooXEvent" c:type="RegressFooXEvent">
-      <type name="gpointer" c:type="gpointer"/>
+      <type name="none" c:type="void"/>
     </alias>
     <alias name="IntsetAlias" c:type="RegressIntsetAlias" introspectable="0">
       <doc xml:space="preserve">Compatibility typedef, like telepathy-glib's TpIntSet</doc>
index b45f532..175a8d3 100644 (file)
@@ -243,8 +243,6 @@ class TestStructTypedefs(unittest.TestCase):
         self.assertTrue(ptr is not None)
         self.assertTrue(isinstance(ptr, ast.Alias))
         self.assertEqual(ptr.ctype, 'TestStructPtr')
-        # This loses type information about the struct which seems broken.
-        self.assertEqual(ptr.target, ast.TYPE_ANY)
 
     def test_struct_tag_pointer(self):
         load_namespace_from_source_string(self.namespace, """