[glib/glib-2-34] build: Don't use C99 declarations



commit 9aa447b13ae82bf23b0e804a7ff724b7f4b435a5
Author: Colin Walters <walters verbum org>
Date:   Thu Nov 1 19:40:41 2012 -0400

    build: Don't use C99 declarations
    
    Since GLib needs to compile with MSVC, we can't use them.  This fixes
    compilation when using -Werror=declaration-after-statement.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687385

 gio/tests/gdbus-proxy.c        |    4 ++--
 gio/tests/gdbus-test-codegen.c |   14 +++++++-------
 glib/gthread-posix.c           |   10 ++++++----
 glib/tests/gdatetime.c         |    3 ++-
 4 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c
index 06bd8aa..7e1326d 100644
--- a/gio/tests/gdbus-proxy.c
+++ b/gio/tests/gdbus-proxy.c
@@ -168,6 +168,8 @@ test_properties (GDBusProxy *proxy)
   GVariant *variant2;
   GVariant *result;
   gchar **names;
+  gchar *name_owner;
+  GDBusProxy *proxy2;
 
   error = NULL;
 
@@ -296,8 +298,6 @@ test_properties (GDBusProxy *proxy)
   g_assert (variant == NULL);
 
   /* Now test that G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES works - we need a new proxy for that */
-  gchar *name_owner;
-  GDBusProxy *proxy2;
   error = NULL;
   proxy2 = g_dbus_proxy_new_sync (g_dbus_proxy_get_connection (proxy),
                                   G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c
index 83965aa..7732fbb 100644
--- a/gio/tests/gdbus-test-codegen.c
+++ b/gio/tests/gdbus-test-codegen.c
@@ -699,6 +699,10 @@ static void
 check_bar_proxy (FooiGenBar *proxy,
                  GMainLoop  *thread_loop)
 {
+  const gchar *array_of_strings[3] = {"one", "two", NULL};
+  const gchar *array_of_strings_2[3] = {"one2", "two2", NULL};
+  const gchar *array_of_objpaths[3] = {"/one", "/one/two", NULL};
+  const gchar *array_of_bytestrings[3] = {"one\xff", "two\xff", NULL};
   guchar ret_val_byte;
   gboolean ret_val_boolean;
   gint16 ret_val_int16;
@@ -744,6 +748,9 @@ check_bar_proxy (FooiGenBar *proxy,
   gchar *val_finally_normal_name;
   GVariant *v;
   gchar *s;
+  const gchar *const *read_as;
+  const gchar *const *read_as2;
+  const gchar *const *read_as3;
 
   data = g_new0 (ClientData, 1);
   data->thread_loop = thread_loop;
@@ -838,10 +845,6 @@ check_bar_proxy (FooiGenBar *proxy,
   /* Try setting properties that requires memory management. This
    * is to exercise the paths that frees the references.
    */
-  const gchar *array_of_strings[3] = {"one", "two", NULL};
-  const gchar *array_of_strings_2[3] = {"one2", "two2", NULL};
-  const gchar *array_of_objpaths[3] = {"/one", "/one/two", NULL};
-  const gchar *array_of_bytestrings[3] = {"one\xff", "two\xff", NULL};
 
   g_object_set (proxy,
                 "s", "a string",
@@ -939,9 +942,6 @@ check_bar_proxy (FooiGenBar *proxy,
    * updates on them works as well (See comment for "property vfuncs"
    * in gio/gdbus-codegen/codegen.py for details)
    */
-  const gchar *const *read_as;
-  const gchar *const *read_as2;
-  const gchar *const *read_as3;
   read_as = foo_igen_bar_get_as (proxy);
   read_as2 = foo_igen_bar_get_as (proxy);
   g_assert_cmpint (g_strv_length ((gchar **) read_as), ==, 2);
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index cb06b14..08e1e9d 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -90,10 +90,12 @@ g_mutex_impl_new (void)
     g_thread_abort (errno, "malloc");
 
 #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-  pthread_mutexattr_t attr;
-  pthread_mutexattr_init (&attr);
-  pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
-  pattr = &attr;
+  {
+    pthread_mutexattr_t attr;
+    pthread_mutexattr_init (&attr);
+    pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+    pattr = &attr;
+  }
 #endif
 
   if G_UNLIKELY ((status = pthread_mutex_init (mutex, pattr)) != 0)
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 4e5ae25..4def53e 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -1193,12 +1193,13 @@ test_z (void)
 {
   GTimeZone *tz;
   GDateTime *dt;
+  gchar *p;
 
   g_test_bug ("642935");
 
   tz = g_time_zone_new ("-08:00");
   dt = g_date_time_new (tz, 0, 0, 0, 0, 0, 0);
-  gchar *p = g_date_time_format (dt, "%z");
+  p = g_date_time_format (dt, "%z");
   g_assert_cmpstr (p, ==, "-0800");
   g_date_time_unref (dt);
   g_time_zone_unref (tz);



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