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
This commit is contained in:
Colin Walters 2012-11-01 19:40:41 -04:00
parent 59a24ab5a3
commit 67466b41af
4 changed files with 17 additions and 14 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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;
}
#endif
if G_UNLIKELY ((status = pthread_mutex_init (mutex, pattr)) != 0)

View File

@ -1185,12 +1185,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);