From e7a59dcf7734fa56c63b09e1e0b92ebbe78b4306 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 7 Nov 2013 17:24:30 -0500 Subject: [PATCH 4/4] Use G_GNUC_BEGIN_IGNORE_DEPRECATIONS to avoid warning spam In these cases, we can't every drop use of our API which we deprecated for external callers; for example where a (deprecated) command line is invoking the deprecated API. This patch avoids having polkit developers get spammed by unfixable warnings. --- src/polkit/polkitpermission.c | 2 ++ src/polkit/polkitsubject.c | 4 ++++ src/polkit/polkitsystembusname.c | 2 ++ src/programs/pkcheck.c | 2 ++ src/programs/pkttyagent.c | 2 ++ test/polkitbackend/test-polkitbackendjsauthority.c | 4 ++++ 6 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/polkit/polkitpermission.c b/src/polkit/polkitpermission.c index 22d195f..54ff415 100644 --- a/src/polkit/polkitpermission.c +++ b/src/polkit/polkitpermission.c @@ -121,8 +121,10 @@ polkit_permission_constructed (GObject *object) { PolkitPermission *permission = POLKIT_PERMISSION (object); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (permission->subject == NULL) permission->subject = polkit_unix_process_new (getpid ()); + G_GNUC_END_IGNORE_DEPRECATIONS if (G_OBJECT_CLASS (polkit_permission_parent_class)->constructed != NULL) G_OBJECT_CLASS (polkit_permission_parent_class)->constructed (object); diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c index aed5795..b86e0b9 100644 --- a/src/polkit/polkitsubject.c +++ b/src/polkit/polkitsubject.c @@ -247,11 +247,15 @@ polkit_subject_from_string (const gchar *str, } else if (sscanf (str, "unix-process:%d:%" G_GUINT64_FORMAT, &scanned_pid, &scanned_starttime) == 2) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new_full (scanned_pid, scanned_starttime); + G_GNUC_END_IGNORE_DEPRECATIONS } else if (sscanf (str, "unix-process:%d", &scanned_pid) == 1) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new (scanned_pid); + G_GNUC_END_IGNORE_DEPRECATIONS if (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject)) == 0) { g_object_unref (subject); diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c index 51e4a69..098e551 100644 --- a/src/polkit/polkitsystembusname.c +++ b/src/polkit/polkitsystembusname.c @@ -389,7 +389,9 @@ polkit_system_bus_name_get_process_sync (PolkitSystemBusName *system_bus_name, g_variant_get (result, "(u)", &pid); g_variant_unref (result); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS ret = polkit_unix_process_new (pid); + G_GNUC_END_IGNORE_DEPRECATIONS out: if (connection != NULL) diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c index 11b2e26..22601f3 100644 --- a/src/programs/pkcheck.c +++ b/src/programs/pkcheck.c @@ -393,6 +393,7 @@ main (int argc, char *argv[]) goto out; } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (sscanf (argv[n], "%i,%" G_GUINT64_FORMAT ",%u", &pid, &pid_start_time, &uid) == 3) { subject = polkit_unix_process_new_for_owner (pid, pid_start_time, uid); @@ -411,6 +412,7 @@ main (int argc, char *argv[]) g_get_prgname (), argv[n]); goto out; } + G_GNUC_END_IGNORE_DEPRECATIONS } else if (g_strcmp0 (argv[n], "--system-bus-name") == 0 || g_strcmp0 (argv[n], "-s") == 0) { diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c index e5088bb..e56f605 100644 --- a/src/programs/pkttyagent.c +++ b/src/programs/pkttyagent.c @@ -109,6 +109,7 @@ main (int argc, char *argv[]) gint pid; guint64 pid_start_time; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (sscanf (opt_process, "%i,%" G_GUINT64_FORMAT, &pid, &pid_start_time) == 2) subject = polkit_unix_process_new_full (pid, pid_start_time); @@ -120,6 +121,7 @@ main (int argc, char *argv[]) g_get_prgname (), opt_process); goto out; } + G_GNUC_END_IGNORE_DEPRECATIONS } if (opt_system_bus_name != NULL) subject = polkit_system_bus_name_new (opt_system_bus_name); diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c index a4de6b1..6c2b5fc 100644 --- a/test/polkitbackend/test-polkitbackendjsauthority.c +++ b/test/polkitbackend/test-polkitbackendjsauthority.c @@ -74,8 +74,10 @@ test_get_admin_identities_for_action_id (const gchar *action_id, authority = get_authority (); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS caller = polkit_unix_process_new (getpid ()); subject = polkit_unix_process_new (getpid ()); + G_GNUC_END_IGNORE_DEPRECATIONS user_for_subject = polkit_identity_from_string ("unix-user:root", &error); g_assert_no_error (error); @@ -340,8 +342,10 @@ rules_test_func (gconstpointer user_data) authority = get_authority (); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS caller = polkit_unix_process_new (getpid ()); subject = polkit_unix_process_new (getpid ()); + G_GNUC_END_IGNORE_DEPRECATIONS user_for_subject = polkit_identity_from_string (tc->identity, &error); g_assert_no_error (error); -- 1.7.1